Inter VLAN Communication (Router on Stick)
Earlier we built and tested the following topology:
Now that we have a better understanding of how routers work, we will solve the problem of inter VLAN communication with a different solution. The problem with the previous solution is scalability. For every VLAN we need to dedicate a link to carry traffic to the router. The routers by default have only two interfaces. How to support more than two VLANs? We will be using additional ports on the switch as well, which will leave less for the end clients.
A trunk can carry traffic for multiple VLAN’s. So if we remove the two links going to the router from the switch, and replace it with one link configured as a trunk, we would be able to carry the traffic from the different VLAN to the router. We still have the problem of having one link on the router, which has to act as the Default Gateway for multiple subnets. We know this is not possible.
The solution is using sub-interfaces. A sub-interface is a virtual interface. The number of sub-interfaces is limited by the hardware, such as the amount of RAM, but theoretically, you are not limited (there is an upper software bound of around 4 billion which is 2^32). For each VLAN we create a sub-interface. Tell the sub- interface which VLAN it is associated with. Assign the Default Gateway IP address of the VLAN to that sub-interface. This is known as “router on a stick”.
To see how router on a stick works, build the following topology:
First we need to change port fa0/24 to be a trunk port. We will be using 802.1q as the trunking encapsulation.
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config-if)#sw trunk encapsulation dot1q
Switch(config-if)#sw mode trunk
Receive our Cisco CCNA Packet Tracer!
Get our complete tutorial in PDF
Watch the video and you will be able to understand Router on Stick much better and Please subscribe to our YouTube Channel.
Also published on Medium.