Use it where a router (or firewall) without enough ports must route several VLANs, or when one VLAN on such a link does not route.
Router-on-a-Stick
Router-on-a-stick routes between VLANs over one trunk link: the switch port is a trunk, and the router has one subinterface per VLAN with encapsulation dot1Q <vlan> and the VLAN's gateway address.
1. Switch: show interfaces trunk — VLAN in the allowed and forwarding lists?
2. Router: show ip interface brief — physical interface and subinterface up?
3. show running-config interface <if>.<n> — encapsulation dot1Q matches the VLAN?
4. Native VLAN handled consistently on both ends?
5. Ping the subinterface address from a host in that VLAN.
switch port trunking → VLAN allowed and forwarding → router subinterface with matching dot1Q VLAN → subinterface up with gateway address → hosts resolve the gateway → traffic routed between VLANs
Compare router encapsulation with switch allowed/native VLAN state and packet tags for the failing VLAN.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
interface <interface>.<subinterface>Primary Commands
Configuration and operational commands for this Topic.
interface <interface>.<subinterface>ReferenceCreate or enter a subinterface.
Use when: Create/enter a router subinterface for router-on-a-stick or other tagged Layer 3 designs.
Quick note: The encapsulation dot1q VLAN ID, not the subinterface number, controls 802.1Q classification.
encapsulation dot1q <vlan>ReferenceAssign an 802.1Q VLAN to a router subinterface (router-on-a-stick).
Use when: Map tagged frames for a VLAN to the correct router subinterface in router-on-a-stick.
Quick note: Verify switch trunk allowed VLANs and the subinterface IP prefix.
Cisco IOS / IOS XE · mixedencapsulation dot1q <vlan> nativeReferenceAssign the native (untagged) VLAN to a router subinterface.
Use when: Match an intentional native VLAN between router-on-a-stick and switch trunk.
Quick note: Compare switch native VLAN and capture tagging if needed.
Cisco IOS / IOS XE · mixedip address <address> <mask>ReferenceAssign an IPv4 address and mask to an interface.
Use when: Use this command at the GRE Tunnels boundary in the documented evidence chain.
Quick note: Cisco IOS / IOS XE first. An up tunnel interface does not prove overlay routing, MTU safety or application reachability.
Cisco IOS / IOS XE · mixedShow Commands
Read-only Cisco show commands for confirming state, narrowing a fault and interpreting the current boundary.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification and output interpretation Verify boundary
Check the switch trunk for allowed/active VLANs and native VLAN state, then verify the router physical interface and each subinterface are operational with the correct encapsulation and IP address. Connected routes should exist for every active subinterface subnet. Use ARP and route/CEF lookups to validate representative endpoints. A subinterface can look correctly configured while its VLAN is not actually allowed on the trunk, so verify both sides. When only one VLAN fails, compare that VLAN's tag/allowance/subinterface mapping rather than assuming the shared physical link is the issue.
Step 2 Packet path Narrow the fault
Host frame → access VLAN → switch trunk adds/handles 802.1Q tag → router subinterface classifies VLAN tag → Layer 3 route decision → egress subinterface/VLAN → destination access port. A wrong tag on one router subinterface can break only that VLAN while the physical link and other VLANs remain healthy.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Each subinterface's VLAN number must match a VLAN the switch trunk allows. The native VLAN is untagged: either use encapsulation dot1Q <vlan> native on the router or keep the native VLAN unused. The physical router interface must be no shutdown.
show interfaces trunk(switch) — trunk up, VLANs allowed and forwarding.show ip interface brief(router) — subinterfaces up/up.show running-config interface <if>.<n>(router) — encapsulation VLAN and address.show vlans(router) — dot1Q VLANs and their subinterfaces.show ip arp(router) — hosts resolved per subinterface.
ReferenceImportant terms & boundaries4 sections · depth on demand
In depth
Router-on-a-stick: one trunk, one subinterface per VLAN
In router-on-a-stick, a router has one physical link to the switch, configured as an 802.1Q trunk. The router creates a subinterface for each VLAN, with encapsulation dot1Q <vlan> and the gateway address for that VLAN.
R1(config)# interface GigabitEthernet0/0/1
R1(config-if)# no shutdown
R1(config)# interface GigabitEthernet0/0/1.20
R1(config-subif)# encapsulation dot1Q 20
R1(config-subif)# ip address 10.20.0.1 255.255.255.0
R1(config)# interface GigabitEthernet0/0/1.30
R1(config-subif)# encapsulation dot1Q 30
R1(config-subif)# ip address 10.30.0.1 255.255.255.0
R1(config)# interface GigabitEthernet0/0/1.998
R1(config-subif)# encapsulation dot1Q 998 native
C9300(config)# interface GigabitEthernet1/0/48
C9300(config-if)# switchport mode trunk
C9300(config-if)# switchport nonegotiate
C9300(config-if)# switchport trunk native vlan 998
C9300(config-if)# switchport trunk allowed vlan 20,30,998
R1# show ip interface brief | include 0/0/1
GigabitEthernet0/0/1 unassigned YES unset up up
GigabitEthernet0/0/1.20 10.20.0.1 YES manual up up
GigabitEthernet0/0/1.30 10.30.0.1 YES manual up up
The switch side (from the Catalyst 9300 trunk guide)
| Point | Detail |
|---|---|
| Trunk mode | switchport mode trunk on the switch port; DTP is pointless towards a router, so add switchport nonegotiate |
| Native VLAN | Must match at both ends (the router's native subinterface) |
| Allowed VLANs | Restrict to the routed VLANs |
| Catalyst 9300 itself | The guide states Layer 3 trunks and subinterfaces aren't supported; the switch routes with SVIs instead |
Trade-offs
| Router-on-a-stick | Layer 3 switch (SVIs) | |
|---|---|---|
| Throughput | Limited by one link; traffic between VLANs crosses it twice | Switch backplane |
| Cost | Uses an existing router | Needs a Layer 3 switch |
| Typical use | Small branches, labs, firewalls as gateways | Campus |
Troubleshooting
| Symptom | Cause |
|---|---|
| One VLAN can't reach its gateway | VLAN missing from the allowed list, or wrong encapsulation dot1Q number |
| Native VLAN traffic lost | Native mismatch between switch and router |
| Slow inter-VLAN traffic | The trunk link is saturated |
Documented example, not captured output.
Quick reference
Router-on-a-stick routes between VLANs with one router interface connected to a switch trunk. Each VLAN gets a subinterface with encapsulation dot1Q <vlan> and the gateway address for that VLAN.
interface Gi0/0.20
encapsulation dot1Q 20
ip address 10.20.0.1 255.255.255.0
interface Gi0/0.30
encapsulation dot1Q 30
ip address 10.30.0.1 255.255.255.0
interface Gi0/0.99
encapsulation dot1Q 99 native
Documented example, not captured output.
All inter-VLAN traffic crosses the single link twice, so throughput is limited; it suits small branches and labs.
State model and protocol mechanics
Router-on-a-stick uses one physical Ethernet link between a switch and router as an 802.1Q trunk. The router creates logical subinterfaces, each configured with a VLAN encapsulation identifier and an IP gateway address. Frames from an access VLAN are tagged by the switch when sent across the trunk, delivered to the matching router subinterface, routed, then emitted through the appropriate destination subinterface and VLAN. A native VLAN may be represented as untagged traffic depending on the configuration and must agree on both ends. Because multiple routed VLANs share one physical interface, the link is a common bandwidth and failure point. The model is conceptually simple but couples Layer-2 trunk correctness directly to all inter-VLAN routing on that router.
Limits and common misconceptions
Physical link up/up does not show every subinterface/VLAN is working. One incorrect VLAN ID can isolate only one subnet while others continue to route. A trunk carrying the VLAN does not show the router subinterface has the right addressing or policy. Router-on-a-stick also does not provide the same scale or failure isolation as distributed Layer-3 switching because many VLANs depend on one link/router interface. Keep trunk transport, VLAN tag mapping, subinterface state, IP routing and endpoint configuration distinct. A working gateway ping from the router itself can also bypass the endpoint's access-port, DHCP and host-firewall conditions, so preserve host-side evidence when validating the complete service path.
ReferenceConfiguration & state2 sections · depth on demand
Cisco IOS / IOS XE baseline
A common design uses a switch port in static trunk mode and a router physical interface with one subinterface per VLAN. Each subinterface uses encapsulation dot1q <vlan> (or ... native only when intentionally matching the switch native VLAN) plus the gateway IP address for that VLAN.
Design and configuration model
Configure the switch-facing interface as an explicit trunk and allow only the VLANs required by the design. On the router, create one subinterface per VLAN, configure the correct encapsulation dot1q VLAN ID and assign the subnet gateway address. If a native VLAN is used, ensure both sides agree and document why. Keep the physical interface enabled while leaving IP addressing on subinterfaces rather than mixing models accidentally. Add upstream routing beyond the connected VLANs as required. Capacity planning matters because traffic between VLANs crosses the same physical link twice in terms of ingress/egress utilization on the router path.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Switching → VLAN → Inter-VLAN Routing → Router-on-a-Stick. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.cisco.com/c/en/us/support/ios-nx-os-software/ios-xe-17/series.html · confidence 94%Quick lookup tables
Router-on-a-Stick · operational reference
Compact state and interpretation boundaries for fast lookup.
| Component | Required state |
|---|---|
| Switch trunk | VLAN allowed/forwarding |
| Router subinterface | Matching dot1q ID + IP |
| RIB | Connected subnet installed |
| Endpoint | Correct gateway/subnet |