By default only hosts are member of the same VLAN can communicate. To change this and allow inter-vlan communication, we need a layer 3 switch or router. Or simply when we want to ping or access a computer which is on other vlan. so we have to place a router for inter routing.
For this purpose we will logically divide the port of router in required parts and will assign IP to them which become the default gateway for both VLAN.
- Switch# vlan database
- Switch(vlan)# vlan 2 name IT
- Switch(vlan)#vlan 3 name HR
- Switch(vlan)# exit
- Switch# conf t
- Switch(config)# int range fa 0/1 โ 8
- Switch(conf_if)# switchport access vlan 2
- Switch(conf_if)# exit
- Switch(config)#int range fa 0/9 โ 15
- Switch(conf_if)# switchport access vlan 3
- Switch(conf_if)# exit
- Switch(conf)# int fa 0/24
- Switch(conf)if)# switchport mode trunk
- Switch(conf_if)# no shut
- Switch(conf_if)# exit
- Switch(conf)# exit
- Now on router do the following configuration
- Router>enable
- Router# conf terminal
- Router(conf)# int fa 0/0.1
- Router(conf_if)# encapsulation dot1q 2
- Router(conf_if)# IP address 192.168.10.1 255.255.255.0
- Router(conf_if)# exit
- Router(conf)# int fa 0/0.2
- Router(conf_if)# encapsulation dot1q 3
- Router(conf_if)# IP address 192.168.20.1 255.255.255.0
- Router(conf_if)# exit
- Router(conf)# int fa 0/0
- Router(conf)if)# no shutdown