Home Courses Resourses Blog About

Inter Vlan Routing

Virtual LANs (VLANs) divide one physical network into multiple broadcast domains. But, VLAN-enabled switches cannot, by themselves, forward traffic across VLAN boundaries. So you need to have routing between these VLANs which is called interVLAN routing.

There are 2 types of Inter-Vlan Routing:-

1. Router on a Stick (ROS)

 Switch Virtual Link The only way to get off a layer two network segment is through a layer three device; commonly referred to as a Default Gateway for host machines. A single Router can utilize an 802.1q trunk link to place a sub-interface in each VLAN using a single physical link and technically have interfaces in all VLAN’s. A Sub-Interface is a logical interface partitioned off from a physical interface. A sub-interface allows you to have multiple interface configurations on a single physical interface. In this lab you’ll use sub-interfaces to match the VLAN’s in the trunk to allow for interfaces in each VLAN and accomplish inter-vlan routing for the hosts as the router has an interface in each layer three network.

To create a new sub-interface you’ll use the interface fa0/0.# command in global configuration mode. To enable the sub-interface to use 802.1q you’ll use the encapsulation dot1q # command whereas # is the dot1q VLAN tag.

R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface fa0/0
R1(config-if)#no shut
R1(config-if)#interface fa0/0.20
R1(config-subif)#encapsulation dot1q 20
R1(config-subif)#ip add

Note: The above command is to create sub interface for single Vlan 20 with encapsulation dot1q. You have to configure another subinterface inorder to communicate VLANs. If you have commected PCs directly then try ping after creating Sub interface with Default gateway as sub interface ip. If you are using Router as PC then follow below command:

R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#no ip routing
R2(config)#ip default-gateway

2.Switch Virtual Link (SVI)

A Switched Virtual Interface (SVI) is a virtual LAN (VLAN) of switch ports represented by one interface to a routing or bridging system. There is no physical interface for the VLAN and the SVI provides the Layer 3 processing for packets from all switch ports associated with the VLAN.
Switch has supervisor engine which has a pool of MAC address and a MAC is given to Logincal interface from the same pool.

 Switch Virtual Link
Switch#int fa0/1
Switch#switchport mode access
Switch#switchport access vlan 10
Switch#int fa0/2
Switch#switchport mode access
Switch#switchport access vlan 20

Once you inserted interface into Vlans you have to create SVi for both vlan and run routing command to perform routing.

Switch# int vlan10
Switch# ip add
Switch#int vlan20
Switch#ip add

Switch#ip routing [Run routing command]

Note: Give IP address to Pc and Default gateway according to your SVIs IP and check the communication.