Router-on-a-Stick Configuration – Detailed Guide
1. Concept of Router-on-a-Stick
- Definition: Router-on-a-Stick is a design where a single physical router interface is used to route between multiple VLANs using logical subinterfaces.
- Purpose: Enables inter-VLAN routing in environments where deploying a Layer 3 switch or multiple router interfaces is not practical.
- Use Case: Small/medium networks, labs, or cost-sensitive scenarios.
2. How a Single Router Interface Handles Multiple VLANs
- Router's physical interface connects to a switch trunk port.
- The interface is divided into subinterfaces (one for each VLAN).
- Each subinterface is configured with its own IP address and 802.1Q VLAN tagging.
3. Requirements for Router-on-a-Stick
- Router with at least one Ethernet interface
- Switch with VLANs configured
- Trunk link (802.1Q) between switch and router
4. Subinterfaces on the Router
- A subinterface is a logical interface (e.g.,
GigabitEthernet0/0.10
for VLAN 10). - Each subinterface is mapped to a unique VLAN via encapsulation.
5. Encapsulation Types
- 802.1Q is the industry standard for VLAN tagging.
- Each subinterface must be configured with the appropriate encapsulation and VLAN ID.
- Native VLAN subinterface is typically for VLAN 1 (or as defined).
6. IP Addressing on Subinterfaces
- Each subinterface gets an IP address from the VLAN’s subnet and acts as the default gateway for that VLAN.
- Example:
- VLAN 10 (192.168.10.0/24) → Router subinterface IP: 192.168.10.1/24
- VLAN 20 (192.168.20.0/24) → Router subinterface IP: 192.168.20.1/24
7. Switch Port Configuration
- The switch port connected to the router must be configured as a trunk.
- All VLANs that require routing must be allowed on the trunk.
Switch(config)# interface GigabitEthernet0/1 Switch(config-if)# switchport mode trunk Switch(config-if)# switchport trunk allowed vlan 10,20
8. Router Subinterface Configuration Example (Cisco IOS)
Suppose the router's physical interface is GigabitEthernet0/0
:
Router(config)# interface GigabitEthernet0/0.10 Router(config-subif)# encapsulation dot1Q 10 Router(config-subif)# ip address 192.168.10.1 255.255.255.0 Router(config)# interface GigabitEthernet0/0.20 Router(config-subif)# encapsulation dot1Q 20 Router(config-subif)# ip address 192.168.20.1 255.255.255.0
Repeat this process for each required VLAN.
9. Routing Between VLANs
- Hosts in each VLAN use the router subinterface IP as their default gateway.
- When a host in VLAN 10 needs to reach VLAN 20:
- Frame is sent to the router via trunk.
- Router routes packet between subinterfaces.
- Frame returns to switch with correct VLAN tag.
10. Verification Commands
Command | Purpose |
---|---|
show ip interface brief | See status/IP of all interfaces |
show running-config interface Gi0/0.10 | Check subinterface config |
show vlan | List VLANs on the switch |
show interfaces trunk | View trunk status/allowed VLANs |
11. Troubleshooting Common Issues
Problem | Cause | Solution |
---|---|---|
VLAN mismatch | VLAN not created/allowed on trunk | Check show vlan , show interfaces trunk |
Encapsulation mismatch | Incorrect or missing dot1Q config | Use encapsulation dot1Q [vlan-id] on subinterface |
Trunk negotiation | One end not trunk | Set switchport mode trunk on both ends |
12. Performance Considerations
- The single router interface is a bandwidth bottleneck—all inter-VLAN traffic must pass through it.
- Best for smaller environments; high-traffic networks should use Layer 3 switches.
13. Security Considerations
- Secure trunk ports (disable unused VLANs, set non-default native VLAN).
- Apply ACLs on the router to control inter-VLAN communication as required.
14. Alternatives to Router-on-a-Stick
- Layer 3 Switch Routing: Handles inter-VLAN routing directly; no single-interface bottleneck.
- Multiple Physical Interfaces: Assign a separate router interface for each VLAN (rare in modern designs).
📘 Example Scenario
Scenario:
- VLAN 10: 192.168.10.0/24 (PCs)
- VLAN 20: 192.168.20.0/24 (Printers)
- Router: GigabitEthernet0/0 to Switch GigabitEthernet0/1 (trunk)
Router Config:
interface GigabitEthernet0/0.10 encapsulation dot1Q 10 ip address 192.168.10.1 255.255.255.0 interface GigabitEthernet0/0.20 encapsulation dot1Q 20 ip address 192.168.20.1 255.255.255.0
Switch Config:
interface GigabitEthernet0/1 switchport trunk encapsulation dot1q switchport mode trunk switchport trunk allowed vlan 10,20
PCs in VLAN 10 use 192.168.10.1 as gateway; printers in VLAN 20 use 192.168.20.1.
Traffic between VLANs is routed by the router-on-a-stick subinterfaces.
📑 Summary Table
Element | Configuration/Role |
---|---|
Router Subinterfaces | One per VLAN, dot1Q encapsulation |
Switchport Mode | Trunk (all VLANs to router) |
Inter-VLAN Routing | Handled by router subinterfaces |
Bottleneck | Yes, single physical interface |
Alternatives | Layer 3 switch, multiple router interfaces |
When to Use Router-on-a-Stick
- Small/medium networks needing inter-VLAN routing.
- Where hardware/cost prevents Layer 3 switch use.
- Lab and training scenarios for VLAN/trunking demonstration.