Share this
Inter-VLAN Routing: Ultimate Configuration Guide for Cisco
by Darin Knobbe on Nov 18, 2021 9:09:59 AM
Table of Contents
In a Layer 2 switched environment, VLANs separate devices into different collision domains and Layer 3 subnets. Devices in the same VLAN can communicate without any routing, and devices in different VLANs require routing to communicate with each other.
L2 switches require an L3 routing device to communicate between different VLANs, and the device is either an external router or Layer 3 module on the same chassis. Most of the Cisco switches have routing capabilities within the switch. When the switch receives a packet, it determines that it belongs to another VLAN, and the switch sends the packet to the appropriate port on the other VLAN.
This blog will discuss inter-VLAN routing configuration examples in Cisco routers and switches.
Download the guide and refer back to it at any time!
What Is Inter-VLAN Routing?
VLANs are used to segment Layer 2 networks. Hosts from one VLAN cannot communicate with hosts in another VLAN unless a router or a Layer 3 switch provides routing services.
Inter-VLAN routing is the technology for communicating network traffic from one VLAN to another VLAN.
There are two well-known inter-VLAN routing options:
- Router-on-a-Stick: This is a suitable solution for small- to medium-sized networks.
- Switched Virtual Interfaces (SVIs): This is the most scalable solution for medium to large organizations, and this solution needs a Layer 3 switch.
Router-on-a-Stick Inter-VLAN Routing Method With a Cisco Router
The "router-on-a-stick" inter-VLAN routing technique needs only one physical interface to route traffic among multiple VLANs on a network. A router's physical interface is configured as an 802.1Q trunk and connected to the Layer 2 switch's trunk interface.
The router interface is configured using subinterfaces for passing multiple VLANs in one interface. The configured subinterfaces are software-based virtual interfaces, and each subinterface is associated with a single physical Ethernet interface. Each sub-interface is configured for different subnets that correspond to their VLAN assignment, which facilitates logical routing.
When VLAN-tagged traffic enters the router interface, the traffic is forwarded to the VLAN subinterface according to the VLAN tag ID. After a routing decision is performed based on the destination address, the router determines the egress interface for the traffic.
NOTE: The router-on-a-stick inter-VLAN method does not scale beyond 50 VLANs.
Router-on-a-Stick Inter-VLAN Routing Configuration Example
This section describes how to configure the router-on-a-stick inter-VLAN routing method. You can see in the image below that the router is connected with a switch using a single interface, and can pass multiple VLANs using that interface via a router-on-a-stick inter-VLAN routing configuration.
The router GigabitEthernet 0/0/0 interface is connected to the Layer 2 switch Ethernet 1/1 port. The Ethernet 1/1 is a trunk link that is required to forward traffic within and between VLANs.
To route between VLANs, the Router GigabitEthernet 0/0/0 interface is logically divided into two subinterfaces, as shown in the table below. The table also shows the two VLANs that will be configured on the switch.
Subinterface | VLAN | IP Address |
G0/0/0.100 |
100 |
10.1.100.1/24 |
G0/0/0.200 |
200 |
10.1.200.1/24 |
Assume that the Router and Switch have basic configurations. Currently, PC1 and PC2 cannot ping each other because they are on different networks.
To enable the PCs to communicate, we need to configure VLANs and trunking in the switch level, and the router must be configured for inter-VLAN routing.
VLAN and Trunking Configuration in Switch
Complete the following steps to configure Switch with VLANs and trunking:
VLAN Configuration
- Step 1 - VLANs Creation: First, the VLANs are created and named, as shown in the below configuration.
- Step 2 -Configure Access Ports: Next, port Eth1/2 connecting to PC1 is configured as an access port in VLAN 100, as shown below. Assume PC1 has been configured with the correct IP address, netmask, and default gateway1.100.1.
Access Port Configuration
- Step 3 -Trunking Port Configuration: Configure the port Eth1/1 as a trunk port like the below configuration.
Trunking Port Configuration
Router Subinterface Configuration
For each VLAN, you need to create a subinterface in the router-on-a-stick method. A subinterface can be created using the interface_id.subinterface_id format in the global configuration mode. The subinterface syntax is the physical interface followed by a period and a subinterface number. Although not required, it is common to match the subinterface number with the VLAN number.
After creating the subinterface, enable the interface with the "no shutdown" command in the interface configuration mode. All the subinterfaces are disabled if the physical interface is disabled.
In the below configuration, the Router G0/0/0 subinterfaces are configured for VLANs 100 and 200.
Verify Connectivity Between PC1 and PC2
After the switch trunk and the router subinterface configurations, the router-on-a-stick configuration is complete. The configuration can be verified from the PC, router, and switch.
From PC1, verify connectivity to a host in another VLAN using the ping command.
Windows PC IP Address
The output confirms the IPv4 address and default gateway of PC1. Next, use ping to verify connectivity with PC2, as shown in the below output. The ping reply confirms that inter-VLAN routing is working.
Router-on-a-Stick Inter-VLAN Routing Verification
Use the below show commands to verify and troubleshoot the router-on-a-stick configuration.
- show ip route
- show ip interface brief
- show interfaces
As shown in the below output, verify that the subinterfaces appear in the router's routing table by using the "show ip route" command. Notice that there are two connected routes (C) and their respective exit interfaces for each routable VLAN. The output confirms that the subnets, VLANs, and subinterfaces are active.
Another useful router command is to show the ip interface brief, as shown below. The output confirms that the subinterfaces have the correct IPv4 address configured and that they are operational.
Subinterfaces can be verified using the show interfaces subinterface-command, as shown in the below output.
In Summary: Inter-VLAN Routing FAQs
What is inter-VLAN routing?
Inter-VLAN routing enables routers or Layer 3 switches to route traffic between VLANs.
Why is inter-VLAN routing necessary?
While it’s sometimes necessary to isolate VLANs and disallow any traffic between them, often some traffic needs to flow between VLANs so certain services and systems are available on any network segment. That’s where inter-VLAN routing comes in.
What are the benefits of inter-VLAN routing?
Inter-VLAN routing allows for communication between different VLANs, which is necessary for certain services and systems to be available across network segments. It also helps in managing network traffic efficiently.
What devices are used in inter-VLAN routing?
Routers or Layer 3 switches are typically used to implement Inter-VLAN routing. These devices can route traffic between VLANs while preserving broadcast domains.
What is the ‘Router-on-a-Stick’ model in inter-VLAN routing?
The ‘Router-on-a-Stick’ model is a common design pattern for Inter-VLAN routing. In this model, a single interface on a router is used to route traffic between multiple VLANs.
How Does Inter-VLAN Routing Improve Network Security?
By segregating the network into different VLANs and controlling the traffic between them using Inter-VLAN routing, network administrators can add an additional layer of security. This can help prevent unauthorized access and contain potential threats within a single VLAN.
What are the practical applications of inter-VLAN routing?
Inter-VLAN routing is commonly used in large enterprise networks to manage network traffic efficiently and securely. It allows for the segregation of different types of traffic (e.g., voice, data, video) into separate VLANs, improving network performance and security.Share this
- Configuration Guides (47)
- Cisco Routers (29)
- Switches (27)
- Network Security (23)
- Cisco Switches (21)
- Routing Protocols (21)
- Routers (20)
- Cisco (19)
- Product Comparisons (19)
- Firewall (18)
- Cisco Security (17)
- Cisco Technical Information (17)
- IT Hardware Solutions (17)
- Network Protocols (17)
- Wireless (17)
- Security (15)
- OneCall (13)
- Servers (12)
- cisco asa (12)
- Cisco Wireless (11)
- Router Protocols (11)
- Cisco Catalyst (9)
- Cisco UCS (9)
- Upgrading Network (9)
- Cisco Servers (8)
- Product Highlight (8)
- Access Control Lists (7)
- Fortinet (7)
- Server Comparisons (7)
- Access Points (6)
- Arista Networks (6)
- OSPF (6)
- Wireless APs (6)
- Cisco ASR (5)
- Cloud Solutions (5)
- HPE-Aruba Wireless (5)
- Juniper Mist (5)
- Network Management (5)
- SD-WAN (5)
- Storage (5)
- Switch Comparison (5)
- Back To Basics (4)
- Cybersecurity (4)
- EIGRP (4)
- Firewall Architecture (4)
- HSRP (4)
- Juniper Networks (4)
- Network Automation (4)
- Network Servers (4)
- OEM Comparison (4)
- Aruba Central (3)
- Cisco Telephony (3)
- DHCP (3)
- DHCP Snooping (3)
- Dell EMC PowerEdge (3)
- Internet (3)
- Maintenance (3)
- Maintenance Renewal (3)
- Network Accessories (3)
- TPM (3)
- Telephony (3)
- aruba (3)
- Cisco NX-OS (2)
- Cisco Nexus (2)
- Dell Servers (2)
- Fortinet NGFWs (2)
- IT Trends (2)
- LAN Networks (2)
- Network Time Protocol (2)
- Palo Alto NGFWs (2)
- Rapid PVST+ (2)
- Remote Configuration (2)
- Software Defined Networking (2)
- WLAN (2)
- Ways to Save (2)
- fortigate (2)
- Asset Management (1)
- CPU Usage (1)
- Cisco AIR-CT (1)
- Cisco Aironet (1)
- Cisco DNA (1)
- Cisco ISR (1)
- Cisco Supervisor Engines (1)
- Cisco UCS Manager (1)
- Cognitive Campus (1)
- Cost of Downtime (1)
- Dell EMC Data Domain (1)
- Edge Switches (1)
- Fabric Extenders (1)
- GRE Tunnel (1)
- HPE BL (1)
- Juniper SRX (1)
- Nexus Switches (1)
- Nutanix (1)
- Optics (1)
- PowerEdge R740xd (1)
- STP Extension (1)
- Sparing Integrity Program (1)
- Switched Virtual Interface (1)
- TCP (1)
- UCS Fabric Interconnects (1)
- hyperconverge (1)
- April 2024 (2)
- March 2024 (1)
- February 2024 (2)
- January 2024 (1)
- December 2023 (1)
- November 2023 (2)
- October 2023 (1)
- September 2023 (3)
- August 2023 (5)
- July 2023 (2)
- June 2023 (4)
- May 2023 (5)
- April 2023 (8)
- March 2023 (7)
- February 2023 (5)
- January 2023 (2)
- December 2022 (3)
- November 2022 (3)
- October 2022 (8)
- September 2022 (9)
- August 2022 (9)
- July 2022 (8)
- June 2022 (9)
- May 2022 (5)
- April 2022 (3)
- March 2022 (1)
- February 2022 (2)
- November 2021 (2)
- October 2021 (1)
- September 2021 (2)
- August 2021 (2)
- July 2021 (3)
- June 2021 (2)
- May 2021 (4)
- April 2021 (4)
- March 2021 (2)
- February 2021 (1)
- January 2021 (2)
- December 2020 (2)
- November 2020 (2)
- October 2020 (2)
- September 2020 (2)
- August 2020 (4)
- July 2020 (5)
- June 2020 (4)
- May 2020 (6)
- April 2020 (2)
- March 2020 (1)
- February 2020 (2)
- January 2020 (2)
- December 2019 (1)
- May 2019 (2)
- April 2019 (5)
- February 2019 (1)
- January 2019 (3)
- December 2018 (1)
No Comments Yet
Let us know what you think