This is a quick write up on how to configure inter VLAN routing in Cisco IOS. This guide is mainly to reference the Cisco IOS commands and assumes you can configure the rest at this level.
Hardware:
Cisco 2911 Router
Cisco 2960 Switch X2
X4 Client PCs
Our objective here is to be able to have devices on VLAN 10, contact devices on VLAN 11. To complicate a little more this will also include a truck between two switches.
1. Configure the PCs IP addresses as follows:
Pc Name: IP / Subnet Mask / Gateway
PC0 – 10.1.10.11 / 255.255.255.0 / 10.1.10.1 [ Will be on VLAN 10 ]
PC1 – 10.1.11.11 / 255.255.255.0 / 10.1.11.1 [ Will be on VLAN 11 ]
PC2 – 10.1.10.12 / 255.255.255.0 / 10.1.10.1 [ Will be on VLAN 10 ]
PC3 – 10.1.11.12 / 255.255.255.0 / 10.1.11.1 [ Will be on VLAN 11 ]
Here, we’re setting up the PCs so that PC0 and PC2 are going to go on VLAN 10 and PC1 and PC3 and going to be on VLAN 11 (There is no DHCP server in this LAB).
2. Next we need to configure the switches, by naming the SW1 and SW2 and then configuring a trunk between them. The cables are connected to GigabitEthernet0/2 on both switches. We also need to create two VLANs (10 and 11). Finally, on SW1, we’ll configure another trunk to the router (on a stick).
Name the Switch, set the Gig0/2 interface to truck mode and allow vlan traffic:
We start on SW1 (but this will be repeated for SW2 for the Gi0/2 connection.)
Switch>en
Switch>enable
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW1
SW1(config)#int gi0/2
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk allowed vlan all
SW1(config-if)#switchport nonegotiate
SW1(config)#interface gi0/1
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk allowed vlan all
SW1(config-if)#switchport nonegotiate
SW1(config)#interface vlan 10
SW1(config-if)#description SALES
exit
SW1(config)#interface vlan 11
SW1(config-if)#description MARKETING
exit
Next we add the ports Fa0/1 and Fa0/2 to their respective VLANs
SW1(config)#interface fa0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
exit
SW1(config)#interface fa0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 11
SW1(config-if)#do show vlan
[Check the ports are listed in their respective VLANs]
SW1 is now configured. Move on to SW2. You do not need to configure Gi0/1 on SW2 as this has NO link to the router. You can do a “Show run” and copy the out put to text file and amend the host name and remove the gigabitethernet0/1 segment and past it into the console of SW2 to do this quickly.
Finally, we configure the router on a stick. Here we will be creating two sub interfaces on Gi0/0. They will be Gi0/0.10 and Gi0/0.11. VLAN 10 will have frames switched to Gi0/0.10 and VLAN 11 will have frames switched to Gi0/0.11.
Router#conf t
Router(config)#inter gi0/0
Router(config)#no shutdown
Router(config)#do show ip inter br
Router(config)#interface gi0/0.10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 10.1.10.1 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#exit
Router(config)#inter gi0/0.11
Router(config-subif)#encapsulation dot1Q 11
Router(config-subif)#ip address 10.1.11.1 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#exit
Router(config)#do show ip interface bri
[ to check the interfaces are UP ]
Thats it! your done! If you go to PC0 and ping 10.1.11.12 this will show the inter VLAN routing is working.
You can Ping PC1, PC2 and PC3 all of which are scattered over various switches on different VLANs.