InterVLAN routing is a means of enabling communication between various VLANS in a switched network. VLANS by default do not communicate with each other, that is, there’s no exchange of packets between VLANS. Without interVLAN routing, John in VLAN 100 will not be able to send that holiday pics he took while in the Bahamas to Mary in VLAN 20.
There are two ways to do this
- Using an external router.
- Using a Cisco multilayer switch.
USING AN EXTERNAL ROUTER
To enable communication between VLANs, an external layer 3 device, think router, is added to the network, then a physical or logical link is created between the VLANS and the router. There are two possible ways to connect with the router;
- Connect the switch to the router with each physical link representing a VLAN
Most Cisco books I’ve read have the habit of talking about this form of interVLAN routing in passing so much that I never bothered to know how to do the configuration or see how it works throughout my CCNA class and even after passing the exam, until I decided put it online. Actually this is an old and outdated form of routing VLANs, and no longer practiced; but it wouldn’t hurt to know it.
If you have 20 VLANs, you need a router with 20 interfaces to connect to, so the VLANs can talk to each other. Imagine having 100 VLANs in an organization, this has made this form of routing impracticable.
Anyway I tried it on a packet tracer, created VLANs, gave them IP addresses, mapped ports to VLANs and connect hosts.
Then I pinged the hosts in different VLANs expecting to make a home run, oops no luck! VLANs won’t talk. I had failed to place each of the switch link connecting to the router into their respective VLANs, I had left them in the default VLAN- VLAN 1. This was corrected and it works.
2. Router on a stick
Here, a single trunked link is made to carry all VLANs, and logical configuration, that is, IP addressing is done at the sub-interface level.
Let’s do a little configuration using the image above. First, let’s go to the switch and trunk the link
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config-if)#switchport mode trunk
Next, let’s enable the router interface and configure IP address at the sub-interface level
Oh, we’ve got some things to explain here.
I had said earlier that IP addressing is done at the sub-interface level, under no condition must IP address be assigned to the interface, routing just won’t work.
Let’s break “encapsulation dot1q 2” into tiny bits
encapsulation dot1q – this means the frame identification method to be used is IEEE 802.1Q protocol.
2- This means VLAN 2. Each figure represents a VLAN
Finally, for the VLANs to communicate I didn’t have to invoke IP routing or configure any routing protocol, they just worked like that.
INTERVLAN ROUTING USING MULTILAYER SWITCH
In the absence of a router, a Cisco multilayer switch can be used to route packets from one VLAN to another. Switches by default operate at layer 2, but a multilayer switch has both layer 3 and layer 4 (network and transport) capabilities in addition to layer 2 capabilities.
Now let’s do some configuration to enable routing on a multilayer switch
First we will need to create and name the VLANs on the multilayer switch
Next is the assignment of IP to these VLANs. I chose to give each VLAN the last available IP in their respective subnet, any IP in the subnet can be used.
And on the other switch, the 2960 which serves as the access layer switch, the management VLAN which is VLAN 1 will be given an IP address and the switch itself will be given a default gateway. The multilayer switch will not use a default gateway because it’s acting as a layer 3 device.
What’s next is the assignment of ports to different VLANs which I have talked about earlier in my first post about VLANs, attach PCs to the ports and assign IP address to the hosts.
One last thing to get the VLANs smiling, shaking hands and exchanging packets
So now let’s test if our VLANs are communicating…… I’m pinging other VLANs from a host in VLAN 1
Oh it’s all fine.