Router-on-a-Stick
Cheat sheet · https://pcornel.dk/topic.php?topic=589
Answer
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.
Remember
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.
First checks
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.
Commands
show ip interface brief- Compact IPv4 interface/address/protocol state.
ip address <address> <mask>- Assign an IPv4 address and mask to an interface.
interface <interface>.<subinterface>- Create or enter a subinterface.
encapsulation dot1q <vlan>- Assign an 802.1Q VLAN to a router subinterface (router-on-a-stick).
encapsulation dot1q <vlan> native- Assign the native (untagged) VLAN to a router subinterface.
Verify in this order
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
Where it usually breaks
physical link → switchport/bundle membership → VLAN/instance state → STP/LAG decision → MAC forwarding → end-to-end frame path
Router-on-a-Stick · operational reference
| Component | Required state |
|---|---|
| Switch trunk | VLAN allowed/forwarding |
| Router subinterface | Matching dot1q ID + IP |
| RIB | Connected subnet installed |
| Endpoint | Correct gateway/subnet |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=589