We learned in a previous lesson that legacy inter-VLAN routing requires multiple physical interfaces on both the router and the switch. But in the ‘Router-on-stick’ configuration only one physical interface 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 VLAN trunking configuration and creates a virtual interface connected to each VLAN. The router creates multiple virtual interfaces for each associated VLAN, and then it handles all frames tagged with that VLAN ID as if they came in and out of that virtual interface. The virtual interfaces also called sub-interfaces of the router.
The sub-interfaces are software-based interfaces; associated with a single physical interface. The sub-interfaces are configured in router’s IOS, each sub-interface is independently working with IP address and VLAN assignment. The sub-interfaces makes routing possible within the network between different VLANs. The router-on-stick method can work and communicate up to 50 VLANs. So, if our network has more than 50 VLAN, then we cannot use Router-on-Stick method normally. The figure below illustrates the Router-on-Stick configuration. The switch is connected to the Router1 using a single; physical network connection (a trunk). The router physical interface has two subinterfaces for both VLAN 100 and VLAN 200.
The topology has two VLANs configured on the switch0 and two sub-interfaces configured on Router0. Both sub-interfaces of the router needed to work as 802.1Q trunk and the switch port as trunk mode. So the router receives VLAN-tagged traffic from the trunk on any of sub-interface and processes the packet for routing decision.
The Host 1 on VLAN 100 is communicating with Host 2 on VLAN 200 through Router0 using a single physical router interface. The host 1 sends its unicast traffic to switch0. The switch0 then tags the unicast traffic as originating on VLAN 100 and forwards the unicast traffic out to its trunk link (G0/1), connected with the Router0. The Router0 accepts the tagged unicast traffic on VLAN 100 and routes it to VLAN 200 using its configured sub-interfaces because the sub-interfaces directly connected with the both of the LAN. The figure below illustrates the directly connected sub-interfaces. The Router0 tagged the unicast traffic as VLAN 30 and sent out to the switch0 using the trunk link. The switch will now remove the VLAN tag of the unicast frame and forwards the frame out to host 2 of VLAN 200.