.
.

Configure Inter-VLAN Routing on Switch

Tutorial of how to configure Inter-VLAN routing on Switch device, step by step
This tutorial is part of a training course Cisco - CCNA

Figure 1.

Routing VLAN on the Cisco Switch

Configuring Cisco Switch device

looks like as in the code below

Switch_A#enable
Switch_A#class (password)
Switch_A#vlan database (enter the VLAN config mode for the VLAN's on Switch_A, add or delete VLAN)
Switch_A(vlan)#vlan 10 name Sales (create a new VLAN called Sales)
Switch_A(vlan)#vlan 20 name Support (create a new VLAN called Support)
Switch_A(vlan)#exit

Switch_A#configure terminal
Switch_A(config)#interface fastethernet 0/5
Switch_A(config-if)#switchport mode access
Switch_A(config-if)#switchport access vlan 10
Switch_A(config-if)#interface fastethernet 0/6
Switch_A(config-if)#Switchport mode access
Switch_A(config-if)#Switchport access vlan 10
Switch_A(config-if)#interface fastethernet 0/7
Switch_A(config-if)#Switchport mode access
Switch_A(config-if)#Switchport access vlan 10
Switch_A(config-if)#interface fastethernet 0/8
Switch_A(config-if)#Switchport mode access
Switch_A(config-if)#Switchport access vlan 10 
Switch_A(config-if)#end

Switch_A#configure terminal
Switch_A(config)#interface fastethernet 0/9
Switch_A(config-if)#switchport mode access
Switch_A(config-if)#switchport access vlan 20
Switch_A(config)#interface fastethernet 0/10
Switch_A(config-if)#switchport mode access
Switch_A(config-if)#switchport access vlan 20
Switch_A(config)#interface fastethernet 0/11
Switch_A(config-if)#switchport mode access
Switch_A(config-if)#switchport access vlan 20
Switch_A(config)#interface fastethernet 0/12
Switch_A(config-if)#switchport mode access
Switch_A(config-if)#switchport access vlan 20
Switch_A(config-if)#end


On the picture below you see how it looks configuration of VLANs associated with the ports

Viewing VLANs launching command: Switch_A#show vlan 

Figure 2.

View VLANs on the Switch

Creating 802.1Q Trunk interfaces

Switch_A#configure terminal (preparation for creating 802.1Q TRUNK on FA0/1)
Switch_A(config)#interface Fast Ethernet 0/1 (entry into config mode fastethetnet interfaces 0/1)
Switch_A(config-if)#switchport mode trunk (set trunk type to type switchport Fa0/1)
Switch_A(config-if)#end

Router#enable
Password:class

Router#configure terminal (entry into Global Configuration Mode Router)

Router(config)#interface Fast Ethernet 0/1 (entry into config mode fastethetnet interfaces 0/1)
Router(config-if)#No shutdown (activation fastethetnet interfaces 0/1)

Router(config-if)#interface FastEthernet 0/1.1 (entry into subinterface 0/1.1 mode for interface 0/1)
Router(config-subif)#encapsulation dot1q 1 (set subinterface 0/1.1 to 802.1 trunking- encapsulation on VLAN 1)
Router(config-subif)#ip address 192.168.1.1 255.255.255.0 (set the IP address for the subinterface 0/1.1 which is also the gateway for the network)

Router(config-subif)#interface FastEthernet 0/1.2 (entry into subinterface 0/1.2 mode for interface 0/1)
Router(config-subif)#encapsulation dot1q 10 (set subinterface 0/1.2 to 802.1 trunking- encapsulation on VLAN 10)
Router(config-subif)#ip address 192.168.5.1 255.255.255.0 (set the IP address for the subinterface 0/1.2 which is also the gateway for the network)


Router(config-subif)#interface FastEthernet 0/1.3 (entry into subinterface 0/1.3 mode for interface 0/1)
Router(config-subif)#encapsulation dot1q 20 (set subinterface 0/1.3 to 802.1 trunking- encapsulation on VLAN 20)
Router(config-subif)#ip address 192.168.7.1 255.255.255.0 (set the IP address for the subinterface 0/1.3 which is also the gateway for the network)
Router(config-subif)#end

Viewing connection of interfaces launching command: Router#show ip route

Viewing connection of interfaces

Try moving connections on ports and ping the IP address (ping should be successful)