configuring Legacy inter-VLAN routing.
Fast Ethernet 0/1 is connected to the pc0 which belongs to VLAN 10 using copper straight-through cable and fast Ethernet 0/2 is connected to pc1 which belongs to VLAN 20. Gigabit Ethernet 0/1 and 0/2 are connected to the router’s Gigabit Ethernet 0/0 and 0/1 respectively. VLAN 10 and VLAN 20 belong to network 192.168.1.0, 192.168.2.0 respectively.
Allocating fast Ethernet 0/1 for VLAN 10 and fast Ethernet 0/2 for VLAN 20.
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport access vlan 20
Allocating fast gigabit ethernet 0/2 for VLAN 10 and gigabit Ethernet 0/1 for VLAN 20. so these interfaces will be in access mode.
Router configuration.
Assigning IP addresses for interfaces. Here gigabit Ethernet 0/1 belongs to VLAN 10 and gigabit Ethernet 0/0 belongs to VLAN 20.
Router(config)#interface gigabitEthernet 0/0
Router(config-if)#no shutdown
pc0 configurations.
pc1 configurations.
Configuring Router on a stick.
Router>en
creating subinterfaces on gigabit ethernet0/0 according to the number of VLANs and setting up encapsulation protocol type with VLAN id.
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#encapsulation dot1Q 20
no shutdown command should be given to gigabit Ethernet 0/0. so that interface will go up. router’s interfaces are shut down by default because of the security purpose.
Router(config-if)#no shutdown
Changing these two interfaces to trunk mode
.
Assigning fast Ethernet 0/1as VLAN 10 and FastEthernet 0/24 as VLAN 20.
Switch(config-if)#switchport access vlan 10
Switch(config)#interface fastEthernet 0/24
Switch(config-if)#switchport access vlan 20
Another important thing is VLAN 30 should be created in switch 1 even it doesn’t have any host belong to VLAN 30. Otherwise, the switch will drop the packet.
Switch(config)#vlan 30
Switch 2 configurations
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport access vlan 10
Switch(config)#interface fastEthernet 0/24
Switch(config-if)#switchport access vlan 20
Switch(config-if)#switchport access vlan 30
default gateway 192.168.1.1
default gateway 192.168.2.1
default gateway 192.168.1.1
pc4 configurations.
default gateway 192.168.2.1
pc5 configurations.
default gateway 192.168.3.1
Configuring inter-VLAN routing with layer 3 switch.
layer 3 Switch configurations
Switch>en
Creating a virtual interface for each VLAN and assigning IP addresses.
Switch(config)#interface vlan 10
Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config)#interface vlan 20
Switch(config-if)#ip address 192.168.2.1 255.255.255.0
Switch(config)#interface vlan 30
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport access vlan 10
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switchport access vlan 20
Switch(config)#interface fastEthernet 0/3
Switch(config-if)#switchport access vlan 30
enabling IP routing on layer 3 switches. ( IP routing is not enabled in layer 3 switch by default .)
Switch(config-if)#ip routing
pc1 configurations.
default gateway 192.168.1.1
default gateway 192.168.2.1
default gateway 192.168.3.1