Router on Stick Configuration Explained

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.

packet tracer lab for router on stick

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 PCs in VLAN-20 have an IP configuration from the network


To learn how to set up this on Packet Tracer, you can check this tutorial.

How to configure VLANs on switches

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.

testing vlan

The following image shows the connectivity test results between PC1, PC3, and PC5.

testing second vlan

The above test results verify the same VLANs have connectivity.

The following image shows the connectivity test results between PC0, PC1, and PC3.

no connectivity between different vlan

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#configure terminal
Router(config)#interface FastEthernet 0/0
Router(config-if)#no ip address
Router(config-if)#no shutdown

creating virtual interface

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

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

router on stick configuration

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.

verifying router on stick

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.

ComputerNetworkingNotes CCNA Study Guide Router on Stick Configuration Explained