Configuration Guide

How to Configure Router-on-a-Stick (Inter-VLAN Routing)

To configure router-on-a-stick: trunk the switch port toward the router, then create a subinterface per VLAN on the router with encapsulation dot1q and an IP. Each subinterface becomes that VLAN's gateway.

Router-on-a-stick routes between VLANs over a single link. See the router-on-a-stick lab.

Step 1: Trunk the switch port to the router

On the switch:
interface gi0/1
switchport mode trunk
The link to the router carries all VLANs

Step 2: Bring up the router physical interface

On the router:
interface gi0/0
no shutdown
No IP on the physical interface itself — it just carries the trunk

Step 3: Create a subinterface per VLAN

interface gi0/0.10
encapsulation dot1q 10
ip address 192.168.10.1 255.255.255.0
VLAN 10 gateway — repeat for each VLAN (.20, .30…)

Verification

show ip interface brief shows the subinterfaces up with their IPs. Set each PC's gateway to its subinterface IP — devices in different VLANs can now ping each other, proving inter-VLAN routing works.

Frequently asked questions

How do I configure router-on-a-stick?

Trunk the switch port to the router, then on the router create a subinterface per VLAN with encapsulation dot1q [vlan] and an IP address — each becomes that VLAN's gateway.

Why does the physical router interface have no IP?

It only carries the trunk; each dot1q subinterface holds the IP and acts as its VLAN's gateway.

What does encapsulation dot1q 10 do?

It tells the subinterface to tag and accept frames for VLAN 10 on the trunk link.

Is router-on-a-stick used in real networks?

In small networks yes; larger ones use Layer 3 switches with SVIs for higher performance, but the concept is identical.

VS
Vipul Sir — Lead Instructor, Attila Technologies20+ years in Cisco networking. Teaching CCNA, CCNP, CCIE & CyberOps in Ahmedabad since 2004.

Want hands-on training?

Learn this on real Cisco lab devices with placement support at Attila Technologies, Ahmedabad.

Start your networking career with Attila Technologies

Hands-on Cisco training, real lab devices and placement support in Ahmedabad.