In any network, a VLAN is used to segment the network. Users in a particular VLAN will not have access to resources in other VLANs.
For host devices in one VLAN to be able to communicate with hosts on another VLAN, a router will be needed to forward the traffic from one VLAN to another. This is because each VLAN has its own broadcast domain.
In a network with two or three VLANs, it is possible to use individual router interfaces to handle traffic from each VLAN in the network. However, as the number of VLANs increases, this becomes inefficient as the router has limited physical interfaces. One solution to this problem is to replace the router with a Layer 3 switch and use the Layer 3 switch to implement inter-VLAN routing. However, this is expensive, especially when the network has not grown very big.
The most cost-effective way to achieve inter-VLAN routing is by implementing Router on a stick configuration. Here, instead of using each router’s physical interfaces to carry traffic from a specific VLAN, we create router sub-interfaces and then use each sub-interface to carry traffic from one VLAN to another.
In this post, I will guide you through the process of implementing inter-vlan routing using a router in a stick configuration using a sample network topology.
Network Topology
The network topology we will be making use of in this post is shown below. As you can see, it consists of two VLANs that are connected to the router using one physical interface through the switch. In these demonstrations, we will create two sub-interfaces on the router so that hosts in each VLAN can use one sub-interface to forward traffic to the other VLAN.
Router on a Stick Configuration: Steps
Here are steps to implement Router on a Stick Configuration using the network topology shown above.
Step 1: Create the Router sub-interfaces
Firstly, Bring the g0/0/0 interface of router0 up.
R0(config)#interface g0/0/0
R0(config-if)#no shutdown
Then configure sub-interfaces g0/0/0.10, enable dot1q encapsulation, and assign it to VLAN10. Put the IP 192.168.12.1/24 on interface g0/0/0.10.
R0(config-if)#interface g0/0/0.10
R0(config-subif)#encapsulation dot1Q 10
R0(config-subif)#ip address 192.168.12.1 255.255.255.0
R0(config-subif)#exit
Configure sub-interfaces g0/0/0.20, enable dot1q encapsulation, and assign it to VLAN20. Put the IP 192.168.21.1/24 on interface g0/0/0.20.
R0(config)#interface g0/0/0.20
R0(config-subif)#encapsulation dot1Q 20
R0(config-subif)#ip address 192.168.21.1 255.255.255.0
Step 2: Create the Necessary VLANs
Configure VLAN10 and VLAN20 on SW0
SW0(config)#vlan 10
SW0(config-vlan)#name Sales
SW0(config-vlan)#exit
SW0(config)#vlan 20
SW0(config-vlan)#name Engineer
SW0(config-vlan)#exit
Step 3: Configure Trunks ports
Configure fa0/1 of SW0 as a trunk port
SW0(config)#interface fa0/1
SW0(config-if)#switchport mode trunk
SW0(config-if)#switchport trunk allowed vlan 10,20
SW0(config-if)#no shutdown
Step 4: Configure access port
Put interface fa0/2 on VLAN10 and interface fa0/3 on VLAN20 and do those ports as access ports.
SW0(config)#interface fa0/3
SW0(config-if)#switchport mode access
SW0(config-if)#switchport access vlan 10
SW0(config-if)#no shutdown
SW0(config-if)#exit
SW0(config)#interface fa0/2
SW0(config-if)#switchport mode access
SW0(config-if)#switchport access vlan 20
SW0(config-if)#no shut
SW0(config-if)#exit
Step 5: Configure the host devices
Assign IP address to the two PCs as labelled in the network topology.
Step 6: Check the routing table on the router
Check the routing on R0
R0#show ip route
Codes: L - local, 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, E - EGP
i - IS-IS, 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
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, GigabitEthernet0/0/0.10
L 192.168.12.1/32 is directly connected, GigabitEthernet0/0/0.10
192.168.21.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.21.0/24 is directly connected, GigabitEthernet0/0/0.20
L 192.168.21.1/32 is directly connected, GigabitEthernet0/0/0.20
As seen above, R0 has added some connected routes in its routing table.
Step 7: Verify Connectivity
To verify that the inter-vlan routing is working, send a ping from PC1 to PC0. As shown on the image below, the PCs is replying.
Related Content;
How to Configure Inter VLAN Routing on Cisco Layer 3 Switch
I am a passionate Networking Associate specializing in Telecommunications.
With a degree in Electronic engineering, I possess a strong understanding of electronic systems and the intricacies of telecommunications networks. I gained practical experience and valuable insights working for a prominent telecommunications company.
Additionally, I hold certifications in networking, which have solidified my expertise in network architecture, protocols, and optimization.
Through my writing skills, I aim to provide accurate and valuable knowledge in the networking field.
Connect with me on social media using the links below for more insights.
You can contact me using [email protected] or connect with me using any of the social media account linked below