Router-on-stick is a router feature. It allows us to configure and use a router interface as many interfaces. It transforms a physical interface into many virtual interfaces.
A router routes data packets between different logical subnets. By default, we can configure one logical subnet per router interface. For example, if we want to configure five logical subnets, we need five router interfaces.
A VLAN is a logical subnet. Devices in different VLANs can not communicate directly. They can communicate through a router. To provide connectivity between different VLANs, you need to configure one router interface in each VLAN. For example, if you want to connect 10 VLANs, you need 10 router interfaces, one for each.
We use Ethernet interfaces to connect VLANs. Routers have limited Ethernet interfaces. Most routers have two or four Ethernet interfaces. Usually, administrators configure many VLANs. To provide connectivity between these VLANs, they need many Ethernet interfaces. For example, they need 25 routers having two Ethernet ports to connect 50 VLANs.
Virtualization solves this problem. It allows us to turn a physical interface into many virtual interfaces. Each virtual interface works as a separate interface. On router, this feature is also known as router-on-stick.
Router-on-stick practice lab
To explain router-on-stick configuration, I will use the following Packet Tracer lab.
In this lab, I have two VLANs: VLAN-10 and VLAN-20. PC-0, PC-2, and PC-4 are members of VLAN-10. PC-1, PC-3, and PC-5 are members of VLAN-20. PCs in VLAN-10 have an IP configuration from the network 10.0.0.0/0. PCs in VLAN-20 have an IP configuration from the network 20.0.0.0/8.
To learn how to set up this on Packet Tracer, you can check this tutorial.
In this network, PCs in the same VLAN have connectivity. PCs in different VLANs have no connectivity. To verify this, you can test connectivity between the same VLAN's PCs.
The following image shows the connectivity test results between PC0, PC2, and PC4.
The following image shows the connectivity test results between PC1, PC3, and PC5.
The above test results verify the same VLANs have connectivity.
The following image shows the connectivity test results between PC0, PC1, and PC3.
The above test results verify different VLANs do not have connectivity.
Router-on-stick configuration
In the router-on-stick configuration, we create virtual interfaces. Creating virtual interfaces is a simple process. We need to run only two commands to use virtualization on an interface. These commands are the no IP address and no shutdown. We need to run these commands in the interface configuration mode of the interface we want to convert into virtual interfaces.
In this lab, the Router's FastEthernet 0/0 is connected to Switch's GigbitEthernet 0/1 interface. All VLANs send their traffic to the router on this interface. We will convert this interface into virtual interfaces.
Run the following commands on this interface.
Router>enable Router#configure terminal Router(config)#interface FastEthernet 0/0 Router(config-if)#no ip address Router(config-if)#no shutdown Router(config-if)#exit
Now, you can create virtual interfaces on this port. To create a virtual interface and enter interface configuration mode, we use the same command we use on the physical interface. The only difference is we add a number to the physical interface's number.
In interface configuration mode, we need to configure two options: the protocol type of the incoming traffic and an IP address.
This port will receive traffic from a trunk port. A trunk port uses the dot1Q protocol. The encapsulation dot1Q command sets the encapsulation type to dot1Q. This command also needs a VLAN number as an argument. We need to specify the VLAN whose traffic this virtual interface will process.
After configuring the encapsulation type, we need to assign an IP address to this interface.
The IP address, we configure here works as the default gateway of the VLAN.
The following command creates a virtual interface for VLAN-10.
Router(config)#interface FastEthernet 0/0.10 Router(config-subif)#encapsulation dot1Q 10 Router(config-subif)#ip address 10.0.0.1 255.0.0.0 Router(config-subif)#exit
The following command creates a virtual interface for VLAN-20.
Router(config)#interface FastEthernet 0/0.20 Router(config-subif)#encapsulation dot1Q 20 Router(config-subif)#ip address 20.0.0.1 255.0.0.0 Router(config-subif)#exit Router(config)#
That's all configuration we need on the router.
Testing and verifying Router-on-stick configuration
To test and verify the router-on-stick configuration, we can test connectivity between different VLANs again.
The following image shows the connectivity test results between PC0, PC1, and PC3.
The above test results verify the router-on-stick configuration.
That's all for this tutorial. In this tutorial, we learned how to configure and use router-on-stick on a router.
This tutorial is a part of the tutorial series on VLAN, VTP, and DTP Concepts and Configurations on Cisco Routers. Other parts of this series are the following.
Chapter 01 VLAN Basic Concepts Explained with Examples
Chapter 02 Advantages and Disadvantages of VLANs
Chapter 03 Static and Dynamic VLAN Membership Explained
Chapter 04 Access Link and Trunk Link Explained
Chapter 05 VLAN Tagging Explained with DTP Protocol
Chapter 06 DTP Modes and Protocol Explained
Chapter 07 802.1Q Native VLAN concept Explained
Chapter 08 Cisco Inter-Switch Link (ISL) Explained
Chapter 09 Trunk Tagging and Frame Tagging Explained
Chapter 10 VTP Modes and VTP Protocol Explained
Chapter 11 VTP Pruning on switches Explained
Chapter 12 VLAN Practice Lab Setup in Packet Tracer
Chapter 13 Configure VTP Server and Client in Switch
Chapter 14 VLAN Configuration Commands Step by Step Explained
Chapter 15 Router on Stick Configuration Explained