-->
🏠 🔍
SHAREOLITE

Inter VLAN routing Cisco Layer 3 switch

In this post , we share a step by step tested and working command line procedure for enabling Inter VLAN routing on a Cisco Layer 3 or L3 switch using Switch Virtual Interface (SVI).  In this simple example we cover the following topics

  • Create VLAN 100  , assign a IP to it (SVI) , connect a host 'A' to VLAN 100
  • Create VLAN 200 , assign a IP to it (SVI), connect a host 'B' to VLAN 200
  • Enable Inter VLAN routing so that host A may reach Host B


Create VLAN 100  , assign a IP to it (SVI) , connect a host 'A' to VLAN 100

Switch1 # config terminal
Switch1(config)#int vlan 100
Switch1(config-if)#description VLAN100
Switch1(config-if)#no shut
Switch1(config-if)#ip address 10.1.1.1 255.255.255.0   
Switch1(config-if)# ^Z

Switch1(config)#interface f1/0/1
Switch1(config-if)#switch access vlan 100
Switch1(config-if)#no shut


With the above steps , VLAN100 will be created and port f1/0/1 is assigned to VLAN100. Connect Host A to this port and assign a IP of range 10.1.1.X say for example 10.1.1.2. 

Verify whether Host A is able to reach the VLAN virtual interface 10.1.1.1 using ping command. Output should show a response as below 

Host A Terminal # ping 10.1.1.1

Pinging 10.1.1.1 with 32 bytes of data:

Reply from 10.1.1.1: bytes=32 time=1ms TTL=127
Reply from 10.1.1.1: bytes=32 time=1ms TTL=127


Create VLAN 200 , assign a IP to it (SVI), connect a host 'B' to VLAN 200

Switch1 # config terminal
Switch1(config)#int vlan 200
Switch1(config-if)#description VLAN200
Switch1(config-if)#no shut
Switch1(config-if)#ip address 20.1.1.1 255.255.255.0
Switch1(config-if)# ^Z

Switch1(config)#interface f1/0/2
Switch1(config-if)#switch access vlan 200
Switch1(config-if)#no shut


With the above steps , VLAN200 will be created and port f1/0/2 is assigned to VLAN200. Connect Host B to this port and assign a IP of range 20.1.1.X say for example 20.1.1.2. 

Verify whether Host B is able to reach the VLAN virtual interface 20.1.1.1 using ping command. Output should show a response as below 

Host B Terminal # ping 20.1.1.1

Pinging 20.1.1.1 with 32 bytes of data:

Reply from 20.1.1.1: bytes=32 time=1ms TTL=127
Reply from 20.1.1.1: bytes=32 time=1ms TTL=127

Now that both the VLANs are created and hosts are connected , lets check whether Host A is able to reach Host B by using ping . You should not observe any ping response and the destination is un-reachable / timeout as they belong to two separate IP ranges and on different VLAN.

Host B Terminal # ping 10.1.1.2

Pinging 10.1.1.2 with 32 bytes of data:

Request timed out
Request timed out

Enabling Inter VLAN routing

Well this is a very simple step. Just enable the IP routing option on your L3 switch . Some switches may require reboot to load the configuration . In such cases issue a reload command.

Verify whether IP routing feature is enabled , when disabled - status would be as below

Switch1#show ip route
Default gateway is not set
Host               Gateway           Last Use    Total Uses  Interface

ICMP redirect cache is empty

Switch1 # config terminal
Switch1(config)# ip routing
Switch1(config-if)# ^Z
Switch1 # reload


Once the switch reboots , verify the routing status and whether either hosts may reach the other end using ping command.


Switch1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
     20.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Vlan100
C       20.1.1.0 is directly connected, Vlan200


Host A Terminal # ping 20.1.1.2

Pinging 20.1.1.2 with 32 bytes of data:

Reply from 20.1.1.2: bytes=32 time=1ms TTL=127
Reply from 20.1.1.2: bytes=32 time=1ms TTL=127

Host B Terminal # ping 10.1.1.2

Pinging 10.1.1.2 with 32 bytes of data:

Reply from 10.1.1.2: bytes=32 time=1ms TTL=127
Reply from 10.1.1.2: bytes=32 time=1ms TTL=127


Hope this helps to some beginners.
Comments

–>