Lab Inter VLAN Routing
Suppose we have one layer 2 switch, one router (layer 3 device), 2 PCs.
On router we have to create two subinterfaces:
1.Fa 0/0.20 with ip address 20.1.1.1 and 2. Fa 0/0.30 with ip address 30.1.1.1
One PC is member of VLAN 20 with ip address 20.1.1.10 and default gateway will be 20.1.1.1
2nd PC is member of VLAN 30 with ip address 30.1.1.50 and default gateway will be 30.1.1.1
Switch>
Switch>en
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
(Creating VLANs)
Switch(config)#vlan 2
Switch(config-vlan)#name IT
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#name HR
Switch(config-vlan)#exit
(Assigning membership)
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 2
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/6
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 3
Switch(config-if)#exit
(Creating trunk over switch)
Switch(config)#interface fastEthernet 0/11
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport nonegotiate
Switch(config-if)#no shutdown
Switch(config-if)#exit
(Creating subinterfaces on router)
Router>
Router>enable
Router#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fastEthernet 0/0
Router(config-if)#no ip address
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
exit
Router(config)#interface fastEthernet 0/0.2
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up
Router(config-subif)#encapsulation dot1q 2
Router(config-subif)#ip address 20.1.1.1 255.0.0.0
Router(config-subif)#exit
Router(config)#interface fastEthernet 0/0.3
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.3, changed state to up
Router(config-subif)#en
Router(config-subif)#encapsulation dot1q 3
Router(config-subif)#ip address 30.1.1.1 255.0.0.0
Router(config-subif)#exit