Router-on-Stick Inter-VLAN Routing – Exclusive Explanation

In a previous lesson, legacy inter-VLAN routing requires multiple physical interfaces on the router and the switch. However, in the ‘Router-on-stick’ configuration, only one physical interface is needed on both sides. The Router-on-a-stick allows routing packets to subnets associated with VLANs connected to a router 802.1Q trunk.

The Router-on-Stick uses a VLAN trunking configuration and creates a virtual interface connected to each VLAN. The router creates multiple virtual interfaces for each associated VLAN and then handles all frames tagged with that VLAN ID as if they came in and out of that virtual interface. The virtual interfaces are also called sub-interfaces of the router.

The sub-interfaces are software-based interfaces associated with a single physical interface. They are configured in the router’s IOS; each sub-interface works independently with IP address and VLAN assignment. The sub-interfaces make routing between different VLANs within the network possible.

The router-on-stick method can work and communicate up to 50 VLANs. So, if our network has more than 50 VLAN, we cannot usually use the Router-on-Stick method. The figure below illustrates the Router-on-Stick configuration. The switch is connected to Router1 using a single physical network connection (a trunk). The router’s physical interface has two subinterfaces for VLAN 100 and VLAN 200.

Network diagram of Router-on-Stick configuration with a Cisco 2950 switch and a router, showing VLAN 100 and VLAN 200 routed via a single trunk link.
This diagram illustrates a Router-on-a-Stick setup where a router uses a single interface with sub-interfaces to route traffic between VLAN 100 and VLAN 200 via a trunk link on a Cisco 2950 switch.

The topology has two VLANs configured on switch0 and two sub-interfaces configured on Router0—both sub-interfaces of the router need to work as 802.1Q trunks and the switch port in trunk mode. So, the router receives VLAN-tagged traffic from the trunk on any sub-interface and processes the packet to make a routing decision.

Host 1 on VLAN 100 communicates with Host 2 on VLAN 200 through Router0 using a single physical router interface. Host 1 sends its unicast traffic to switch0. The switch0 tags the unicast traffic as originating on VLAN 100 and forwards it to its trunk link (G0/1), connected with Router0.

The Router0 accepts the tagged unicast traffic on VLAN 100 and routes it to VLAN 200 using its configured sub-interfaces because they are directly connected with both LANs. The figure below illustrates the directly connected sub-interfaces.

The Router0 tagged the unicast traffic as VLAN 200 and sent it to switch0 using the trunk link. The switch will now remove the VLAN tag of the unicast frame and forward the frame out to Host 2 of VLAN 200.

CLI output from a Cisco router displaying route codes and connected networks for interfaces Fa0/0.100 and Fa0/0.200.
Router-on-Stick Inter-VLAN Routing - Exclusive Explanation 3

Configure Router-on-a-Stick

Legacy inter-VLAN routing needs a physical interface for each VLAN, and the router has limited physical interfaces. Thus, its use is minimal. More physical interfaces are required as the number of VLANs increases on a network.

This configuration is not practical in an extensive network. So, the following solution for up to 50 VLANs is a router-on-a-stick configuration, which uses VLAN trunking and sub-interfaces.

As we learned in the previous article, VLAN trunking allows a single physical router interface to route traffic for many VLANs. This technique overcomes the hardware limitations based on physical router interfaces. The figure below illustrates the Router-on-Stick configuration.

When configuring inter-VLAN routing using the router-on-a-stick model, the connected switch port must be configured as a trunk. The router’s subinterfaces for each unique VLAN on the network must be assigned an IP address specific to its subnet/VLAN and configured to tag frames for that VLAN. So, we are going to configure Router-on-Stick inter-VLAN routing.

Switch Configuration for Router-on-a-Stick

To enable Router-on-a-Stick inter-VLAN routing, the switch port connected to the router must be configured as a trunk. Below is a detailed configuration for a Cisco switch (e.g., 2950-24TT) with VLAN 100 and VLAN 200.

Prerequisites

  • VLANs 100 and 200 are created on the switch.
  • The switch port (e.g., G0/1) is connected to the router’s physical interface.

Configuration Steps

  1. Enter Global Configuration Mode:
    • Access the switch CLI and enter configuration mode.
  2. Configure the Trunk Port:
    • Set the port connected to the router as a trunk using 802.1Q encapsulation.
  3. Assign VLANs to Ports:
    • Ensure ports for hosts are in access mode for their respective VLANs.
  4. Save the Configuration:
    • Write the changes to the startup configuration.

Example Configuration

Switch>enable
Switch#configure terminal
Switch(config)#vlan 100
Switch(config-vlan)#name admin
Switch(config-vlan)#exit
Switch(config)#vlan 200
Switch(config-vlan)#name account
Switch(config-vlan)#exit
Switch(config)#interface range gigabitEthernet 0/1 - 5
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 100
Switch(config-if-range)#exit
Switch(config)#interface range gigabitEthernet 0/6 - 10
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 200
Switch(config-if-range)#exit
Switch(config)#interface gigabitEthernet 0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#exit
Switch(config)#do write
Building configuration...
[OK]
Switch(config)#exit

Verification Commands

show vlan brief: Confirm VLANs and port assignments.

show interfaces trunk: Verify the trunk status on G0/1.

Router Configuration for Router-on-a-Stick

The router uses sub-interfaces on a single physical interface to route traffic between VLANs. Below is a configuration for Router0 with VLAN 100 and VLAN 200.

Prerequisites

  • The router’s physical interface (e.g., G0/0) is connected to the switch trunk port.
  • 802.1Q trunking is supported on the router.

Configuration Steps

  1. Enter Global Configuration Mode:
  2. Configure Sub-Interfaces:
    • Create sub-interfaces for each VLAN with IP addresses and VLAN tags.
  3. Enable the Physical Interface:
    • Ensure the main interface is active.
  4. Save the Configuration:
    • Write changes to the startup configuration.

Example Configuration:

Router>enable
Router#configure terminal
Router(config)#interface gigabitEthernet0/0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface gigabitEthernet0/0.100
Router(config-subif)#encapsulation dot1q 100
Router(config-subif)#ip address 192.168.100.1 255.255.255.0
Router(config-subif)#exit
Router(config)#interface gigabitEthernet0/0.200
Router(config-subif)#encapsulation dot1q 200
Router(config-subif)#ip address 192.168.200.1 255.255.255.0
Router(config-subif)#exit
Router(config)#do write
Building configuration...
[OK]
Router(config)#exit

Verification Commands

show ip interface brief: Check sub-interface status and IP addresses.

show running-config | section interface: Verify sub-interface configuration.

ping 192.168.200.2: Test connectivity to a host in VLAN 200.

Troubleshooting Router-on-a-Stick

Common issues with Router-on-a-Stick can disrupt inter-VLAN communication. Below are problems and solutions:

Hosts Cannot Communicate Across VLANs

  • Cause: Trunk link not configured correctly.
  • Solution: Verify show interfaces trunk on the switch and ensure G0/1 is in trunk mode with 802.1Q encapsulation.

Example:

Switch#show interfaces trunk
Port        Mode         Encapsulation  Status
Gi0/1       trunk        802.1q         up

Sub-Interface Issues

  • Cause: Incorrect VLAN tagging or IP mismatch.
  • Solution: Check sub-interface configuration with show running-config and ensure VLAN IDs and IP addresses match (e.g., G0/0.100 for VLAN 100).

Example:

Router#show running-config | section interface
interface GigabitEthernet0/0.100
 encapsulation dot1q 100
 ip address 192.168.100.1 255.255.255.0

Packet Drops on Trunk

  • Cause: MTU mismatch or encapsulation error.
  • Solution: Ensure both router and switch use dot1q encapsulation and match MTU settings (default 1500 bytes).

Tips

  • Use ping and traceroute to test connectivity.
  • Enable debug ip packet on the router for detailed packet flow (use cautiously).

Comparison with Multilayer Switch Routing

Router-on-a-Stick is efficient for small networks, but multilayer switch routing offers advanced capabilities:

Router-on-a-Stick

  • Pros: Uses a single router interface, cost-effective for up to 50 VLANs.
  • Cons: Potential bottleneck on the trunk link, limited scalability.

Multilayer Switch Routing

  • Pros: Hardware-based routing, high performance, supports hundreds of VLANs.
  • Cons: Requires a Layer 3 switch, higher initial cost.
  • Use Case: Ideal for large enterprise networks.

When to Use Router-on-Stick?

Best for small to medium networks or as a learning tool for CCNA/CCNP certification.

FAQs

  • What is Router-on-a-Stick and how does it differ from Legacy Inter-VLAN Routing?

    Router-on-a-Stick uses a single router interface with sub-interfaces and 802.1Q trunking to route between VLANs, unlike Legacy Inter-VLAN Routing, which requires multiple physical interfaces per VLAN.

  • How many VLANs can Router-on-a-Stick support?

    Router-on-a-Stick can support up to 50 VLANs, making it suitable for small to medium networks but impractical for larger setups with more VLANs.

  • What are the steps to configure a Router-on-a-Stick?

    Configure the switch port as a trunk with 802.1Q, create sub-interfaces on the router for each VLAN with unique IP addresses, and ensure the physical interface is active.

     

  • Why might inter-VLAN routing fail with Router-on-a-Stick?

    Failure can occur due to misconfigured trunk links, incorrect VLAN tagging on sub-interfaces, or IP address mismatches, which can be diagnosed with show commands.

  • Is Router-on-a-Stick suitable for large enterprise networks?

    It’s not ideal for large networks due to the 50 VLAN limit and potential trunk bottlenecks; multilayer switch routing is preferred for scalability.

Avatar of Asad Ijaz

Asad Ijaz

NetworkUstad's lead networking architect with CCIE certification. Specializes in CCNA exam preparation and enterprise network design. Authored 2,800+ technical guides on Cisco systems, BGP routing, and network security protocols since 2018. Picture this: I'm not just someone who writes about tech; I'm a certified expert in the field. I proudly hold the titles of Cisco Certified Network Professional (CCNP) and Cisco Certified Network Associate (CCNA). So, when I talk about networking, I'm not just whistling in the dark; I know my stuff! My website is like a treasure trove of knowledge. You'll find a plethora of articles and tutorials covering a wide range of topics related to networking and cybersecurity. It's not just a website; it's a learning hub for anyone who's eager to dive into the world of bits, bytes, and secure connections. And here's a fun fact: I'm not a lone wolf in this journey. I'm a proud member and Editor of Team NetworkUstad. Together, we're on a mission to empower people with the knowledge they need to navigate the digital landscape safely and effectively. So, if you're ready to embark on a tech-savvy adventure, stick around with me, Asad Ijaz Khattak. We're going to unravel the mysteries of technology, one article at a time!"