Router-on-a-stick

1. Router-on-a-Stick Configuration

The Router-on-a-Stick method enables a single router interface to route traffic between multiple VLANs using subinterfaces.

Router on a Stick Topology 1

This technique is commonly implemented in networks with VLANs needing intercommunication through a router.

Key Topology Overview

  • SW1 (Switch) connected to multiple VLANs: VLAN 10, VLAN 20, VLAN 30.
  • R1 (Router) configured with a single physical interface (G0/0), divided into subinterfaces to route traffic between VLANs through a trunk link to SW1.

2. Configuring Router-on-a-Stick

Step 1: Configure the Switch (SW1)

  1. Set Up Trunk Port on SW1 The switch port connecting to the router (G0/0) must allow traffic from all VLANs, so configure it as a trunk port:
SW1(config)# interface GigabitEthernet0/0
SW1(config-if)# switchport mode trunk
SW1(config-if)# switchport trunk allowed vlan 10,20,30
  1. Assign VLANs to Access Ports

Configure each access port on the switch for a specific VLAN:

  • VLAN 10 on G0/1:
SW1(config)# interface GigabitEthernet0/1
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 10
  • VLAN 20 on G0/2:
SW1(config)# interface GigabitEthernet0/2
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 20
  • VLAN 30 on G0/3:
SW1(config)# interface GigabitEthernet0/3
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 30

Step 2: Configure Router Subinterfaces for VLANs on R1

Router on a Stick Topology 2
  1. Create Subinterfaces

Each VLAN requires a subinterface on G0/0, with each subinterface assigned a unique IP address to act as the default gateway for devices within that VLAN.

  • VLAN 10:
R1(config)# interface GigabitEthernet0/0.10
R1(config-subif)# encapsulation dot1Q 10
R1(config-subif)# ip address 192.168.10.1 255.255.255.0
  • VLAN 20:
R1(config)# interface GigabitEthernet0/0.20
R1(config-subif)# encapsulation dot1Q 20
R1(config-subif)# ip address 192.168.20.1 255.255.255.0
  • VLAN 30:
R1(config)# interface GigabitEthernet0/0.30
R1(config-subif)# encapsulation dot1Q 30
R1(config-subif)# ip address 192.168.30.1 255.255.255.0

3. Verification

To verify the Router-on-a-Stick configuration, we will ping from PC1 in VLAN 10 (192.168.10.10) to PC3 in VLAN 30 (192.168.30.10). This test confirms that the router is correctly routing traffic between VLANs through its subinterfaces.

Verify Router on a Stick
PC1> ping 192.168.30.10

Pinging 192.168.30.10 with 32 bytes of data:

Reply from 192.168.30.10: bytes=32 time<1ms TTL=64
Reply from 192.168.30.10: bytes=32 time<1ms TTL=64
Reply from 192.168.30.10: bytes=32 time<1ms TTL=64
Reply from 192.168.30.10: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.30.10:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = <1ms, Maximum = <1ms, Average = <1ms

The successful ping confirms that the Router-on-a-Stick configuration is operational, allowing communication between VLAN 10 and VLAN 30 via the router’s subinterfaces.

Now that we have seen how to configure Router-on-a-Stick, we will move on to exploring SVI Inter-VLAN Routing !