In this post, we are going to learn how to configure Router on a stick (Inter VLAN Routing). This is the most popular concept in Virtual LAN configuration. It allows you to add multiple VLAN to the router with the help of a single port.
In a normal scenario, if you want to add 10 VLAN to the router means you must need at least 10 physical port to the router, Am I right. But this is the old method. The router on a stick is the virtual LAN configuration which allows you to add multiple VLAN to the single port of the router.
HOW TO CONFIGURE ROUTER ON A STICK
We are going to configure the router on a stick according to the below-given diagram.
First of all, let’s configure VLAN on the switch
(Note: The text in black is the command used to configure inter VLAN, text in blue indicates the output and text in green indicate the uses of the command.)
Switch>en (enable privilege mode)
Switch#conf t (entering configuration mode)
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10 (Creating VLAN 10)
Switch(config-vlan)#name production (Assigning name to VLAN)
Switch(config-vlan)#vlan 20 (Creating VLAN 20)
Switch(config-vlan)#name sales (Assigning name to VLAN)
Switch(config-vlan)#exit
Switch(config)#int f0/1 (Selecting port 1 of the switch)
Switch(config-if)#switchport access vlan 10 (Assigning port 1 to VLAN 10)
Switch(config-if)#int f0/2 (Selecting port 2 of the switch)
Switch(config-if)#switchport access vlan 20 (Assigning port 2 to VLAN 20)
Switch(config-if)#int f0/3 (Selecting port 3 of the switch)
Switch(config-if)#switchport mode trunk (Configuring port 3 as trunk)
Switch(config-if)#exit
Switch(config)#do copy run start (Save switch configuration)
Destination filename [startup-config]?
Building configuration…
[OK]
Switch(config)#
CONFIGURE ROUTER ON A STICK
Router>en (enable privilege mode)
Router#conf t (entering configuration mode)
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0.1 (Creating and selecting sub-interface port “f0/0.1” on f0/0)
Router(config-subif)#encapsulation dot1q 10 (Assigning the sub-interface port f0/0.1 to VLAN 10. Here, 10 is the VLAN number)
Router(config-subif)#ip address 10.0.0.1 255.0.0.0 (Assigning IP Address to the sub-interface port f0/0.1)
Router(config-subif)#exit
Router(config)#int f0/0.2 (Creating and selecting sub-interface port “f0/0.2” on f0/0)
Router(config-subif)#encapsulation dot1q 20 (Assigning the sub-interface port f0/0.2 to VLAN 20. Here, 20 is the VLAN number)
Router(config-subif)#ip address 20.0.0.1 255.0.0.0 (Assigning IP Address to the sub-interface port f0/0.2)
Router(config-subif)#exit
Router(config)#exit
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#conf t (Entering configuration mode)
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0 (Selecting f0/0 port)
Router(config-if)#no shutdown (Enabling the fast ethernet port f0/0)
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up
%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up
Router(config-if)#
That’s it, this how to configure the router on a stick inter VLAN routing. Now, try to ping between VLAN 10 and VLAN 20, it should be able to ping.
Click here to Download the Router on a stick configuration file on packet tracer