VLANs (Virtual Local Area Networks) allow network administrators to divide a physical switched network into separate logical networks.
For example, an organization may create separate VLANs for:
- Finance
- Human Resources
- IT
- Servers
- Guest users
- Management devices
Devices within the same VLAN can normally communicate through Layer 2 switching.
However, devices in different VLANs belong to different Layer 3 networks and require a router or Layer 3 switch to communicate.
Router-on-a-Stick (ROAS) is an inter-VLAN routing technique that allows a single physical router interface to route traffic between multiple VLANs.
Instead of requiring one physical router interface for every VLAN, Router-on-a-Stick creates multiple logical subinterfaces on one physical interface.
Each subinterface represents a VLAN and normally provides the default gateway for that VLAN.

Router-on-a-Stick Fundamentals
Router-on-a-Stick combines Layer 2 VLAN switching with Layer 3 routing.
A Layer 2 switch maintains VLAN separation, while an external router performs routing between the VLAN networks.
Main Components
| Component | Purpose |
|---|---|
| VLAN | Creates a separate logical Layer 2 network |
| Access Port | Connects an endpoint to a specific VLAN |
| Trunk Port | Carries traffic for multiple VLANs |
| IEEE 802.1Q | Adds VLAN identification to Ethernet frames |
| Router Interface | Provides the physical connection to the switch |
| Router Subinterface | Provides Layer 3 processing for a VLAN |
| Default Gateway | Allows devices to communicate outside their local subnet |
What Is a Router Subinterface?
A subinterface is a logical interface created under a physical router interface.
For example:
| Subinterface | VLAN | IP Address |
|---|---|---|
| GigabitEthernet0/0.10 | 10 | 192.168.10.1/24 |
| GigabitEthernet0/0.20 | 20 | 192.168.20.1/24 |
| GigabitEthernet0/0.30 | 30 | 192.168.30.1/24 |
All three subinterfaces use the same physical interface:
GigabitEthernet0/0
However, each subinterface processes traffic for a different VLAN.
What Is an 802.1Q Trunk?
A trunk link carries traffic belonging to multiple VLANs over one physical connection.
IEEE 802.1Q provides VLAN identification by inserting VLAN information into Ethernet frames travelling across the trunk.
For example:
| Traffic | VLAN ID |
|---|---|
| Finance | 10 |
| HR | 20 |
| IT | 30 |
The VLAN ID allows the switch and router to determine which logical network the frame belongs to.

Native VLAN
An 802.1Q trunk can also have a native VLAN.
On conventional Cisco 802.1Q trunks, frames belonging to the native VLAN are normally transmitted without an 802.1Q VLAN tag.
The native VLAN configuration should therefore match on both ends of the trunk.
How Router-on-a-Stick Routes Traffic
Understanding the packet flow is one of the most important parts of learning Router-on-a-Stick.
Consider this network:
PC1 — Finance
- VLAN: 10
- IP Address: 192.168.10.10/24
- Default Gateway: 192.168.10.1
PC2 — HR
- VLAN: 20
- IP Address: 192.168.20.10/24
- Default Gateway: 192.168.20.1
PC1 wants to communicate with PC2.
Step 1 — PC1 Checks the Destination
PC1 compares the destination IP address with its own subnet.
PC1 belongs to:
192.168.10.0/24
PC2 belongs to:
192.168.20.0/24
Because PC2 is on another subnet, PC1 sends the packet toward its default gateway:
192.168.10.1
Step 2 — PC1 Resolves the Gateway MAC Address
Before PC1 can send the Ethernet frame, it needs the MAC address associated with its default gateway.
If the address is not already in the ARP cache, PC1 uses ARP to discover it.
Step 3 — Switch Receives the VLAN 10 Frame
PC1 is connected to an access port assigned to VLAN 10.
The switch therefore associates the incoming frame with VLAN 10.
When the switch forwards the frame across the router trunk, it identifies the traffic as VLAN 10 using 802.1Q tagging.
Step 4 — Router Receives the Frame
The router receives the frame through its physical interface.
Because the frame belongs to VLAN 10, it is processed by:
GigabitEthernet0/0.10
The router removes the incoming Layer 2 framing and examines the destination IP address.
Step 5 — Router Performs Layer 3 Routing
The router checks its routing table.
It recognizes:
192.168.20.0/24
as a directly connected network through:
GigabitEthernet0/0.20
The router therefore forwards the packet toward VLAN 20.
Step 6 — Router Sends the Packet Back to the Switch
The router creates a new Ethernet frame for VLAN 20.
If necessary, it uses ARP to discover PC2’s MAC address.
The frame is transmitted through the same physical router interface, but this time as VLAN 20 traffic.
Step 7 — Switch Delivers the Frame to PC2
The switch receives the VLAN 20 frame on the trunk.
It forwards the frame through the appropriate VLAN 20 access port.
PC2 receives the packet.

Cisco Router-on-a-Stick Configuration
The following example creates three user VLANs.
| VLAN | Department | Network | Gateway |
|---|---|---|---|
| 10 | Finance | 192.168.10.0/24 | 192.168.10.1 |
| 20 | HR | 192.168.20.0/24 | 192.168.20.1 |
| 30 | IT | 192.168.30.0/24 | 192.168.30.1 |
| 999 | Native / Unused | No User Subnet | None |
Lab Topology
| Device | Interface | Connection |
|---|---|---|
| Router R1 | Gi0/0 | SW1 Gi0/1 |
| Switch SW1 | Gi0/1 | Router trunk |
| PC1 | Ethernet | SW1 Fa0/1 |
| PC2 | Ethernet | SW1 Fa0/2 |
| PC3 | Ethernet | SW1 Fa0/3 |
Endpoint Addressing
| Device | IP Address | Subnet Mask | Default Gateway |
|---|---|---|---|
| PC1 | 192.168.10.10 | 255.255.255.0 | 192.168.10.1 |
| PC2 | 192.168.20.10 | 255.255.255.0 | 192.168.20.1 |
| PC3 | 192.168.30.10 | 255.255.255.0 | 192.168.30.1 |

Create the VLANs
Configure the VLANs on SW1.
enable
configure terminal
vlan 10
name FINANCE
exit
vlan 20
name HR
exit
vlan 30
name IT
exit
vlan 999
name UNUSED_NATIVE
exit
Configure the Access Ports
Assign the three endpoint ports to their respective VLANs.
interface FastEthernet0/1
description FINANCE-PC
switchport mode access
switchport access vlan 10
spanning-tree portfast
exit
interface FastEthernet0/2
description HR-PC
switchport mode access
switchport access vlan 20
spanning-tree portfast
exit
interface FastEthernet0/3
description IT-PC
switchport mode access
switchport access vlan 30
spanning-tree portfast
exit
The ports now belong to:
- Fa0/1 — VLAN 10
- Fa0/2 — VLAN 20
- Fa0/3 — VLAN 30
Configure the 802.1Q Trunk
Configure the switch interface connected to R1.
interface GigabitEthernet0/1
description TRUNK-TO-R1
switchport mode trunk
switchport trunk native vlan 999
switchport trunk allowed vlan 10,20,30,999
switchport nonegotiate
no shutdown
exit
end
The important commands are:
| Command | Purpose |
|---|---|
switchport mode trunk |
Configures the interface as a trunk |
switchport trunk native vlan 999 |
Configures the native VLAN |
switchport trunk allowed vlan 10,20,30,999 |
Restricts VLANs allowed across the trunk |
switchport nonegotiate |
Disables DTP negotiation where supported |
no shutdown |
Enables the interface |
Configure the Router Physical Interface
Configure R1.
enable
configure terminal
interface GigabitEthernet0/0
description TRUNK-TO-SW1
no ip address
no shutdown
exit
The physical interface does not require an IP address in this design.
IP addresses will be configured on its subinterfaces.
Configure VLAN 10 Subinterface
interface GigabitEthernet0/0.10
description FINANCE-GATEWAY
encapsulation dot1Q 10
ip address 192.168.10.1 255.255.255.0
exit
Configure VLAN 20 Subinterface
interface GigabitEthernet0/0.20
description HR-GATEWAY
encapsulation dot1Q 20
ip address 192.168.20.1 255.255.255.0
exit
Configure VLAN 30 Subinterface
interface GigabitEthernet0/0.30
description IT-GATEWAY
encapsulation dot1Q 30
ip address 192.168.30.1 255.255.255.0
exit
Configure the Native VLAN Subinterface
interface GigabitEthernet0/0.999
description UNUSED-NATIVE-VLAN
encapsulation dot1Q 999 native
no ip address
exit
end
The router now has a Layer 3 gateway for each user VLAN.
Save the Configuration
On the router and switch:
copy running-config startup-config
Verification and Troubleshooting
Configuration should always be followed by verification.
Do not assume Router-on-a-Stick is working simply because the commands were accepted.
Verify VLANs
On SW1:
show vlan brief
Example:
VLAN Name Status Ports
---- ----------------- --------- ----------------
1 default active
10 FINANCE active Fa0/1
20 HR active Fa0/2
30 IT active Fa0/3
999 UNUSED_NATIVE active
Actual output varies by switch model and configuration.
Verify the Trunk
show interfaces trunk
Example:
Port Mode Encapsulation Status Native vlan
Gi0/1 on 802.1q trunking 999
Port Vlans allowed on trunk
Gi0/1 10,20,30,999
Confirm that:
- The interface is trunking.
- Native VLAN is 999.
- VLANs 10, 20 and 30 are allowed.
Verify Router Interfaces
On R1:
show ip interface brief
Example:
Interface IP-Address Status Protocol
Gi0/0 unassigned up up
Gi0/0.10 192.168.10.1 up up
Gi0/0.20 192.168.20.1 up up
Gi0/0.30 192.168.30.1 up up
Gi0/0.999 unassigned up up
Verify the Routing Table
show ip route connected
Example:
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0.10
C 192.168.20.0/24 is directly connected, GigabitEthernet0/0.20
C 192.168.30.0/24 is directly connected, GigabitEthernet0/0.30
The router should recognize all three user networks as directly connected.
Test Inter-VLAN Connectivity
From PC1:
ping 192.168.20.10
Then test PC3:
ping 192.168.30.10
Successful replies indicate that inter-VLAN routing is functioning.
Common Router-on-a-Stick Problems
| Problem | Possible Cause | Check |
|---|---|---|
| PC cannot reach gateway | Incorrect VLAN or endpoint addressing | Access VLAN and default gateway |
| All VLAN routing fails | Physical or trunk link problem | Interface and trunk status |
| One VLAN fails | Incorrect subinterface configuration | VLAN ID and encapsulation dot1Q |
| Selected VLANs fail | VLAN missing from allowed list | Trunk allowed VLANs |
| Native VLAN warning | Native VLAN mismatch | Both ends of trunk |
| Subinterfaces are down | Parent interface or physical link down | Router physical interface |
| Ping fails despite correct routing | ACL or endpoint firewall | Security policies |
| Performance is poor | Shared link congestion | Interface utilization and counters |
Useful Switch Commands
show vlan brief
show interfaces trunk
show interfaces GigabitEthernet0/1 switchport
show mac address-table
show interfaces GigabitEthernet0/1
Useful Router Commands
show ip interface brief
show ip route
show ip arp
show interfaces GigabitEthernet0/0
show running-config interface GigabitEthernet0/0.10
show running-config interface GigabitEthernet0/0.20
show running-config interface GigabitEthernet0/0.30
Advantages, Limitations and Design Considerations
Router-on-a-Stick is simple and useful, but it is not the best inter-VLAN routing design for every environment.
Advantages
| Advantage | Explanation |
|---|---|
| Cost-Effective | Multiple VLANs share one router interface |
| Simple Design | Easy to understand and configure |
| VLAN Segmentation | Maintains separate Layer 2 broadcast domains |
| Flexible | Additional VLANs can be supported using new subinterfaces |
| Centralized Routing | Inter-VLAN traffic passes through the router |
| Policy Control | Router ACLs can control traffic between networks |
Limitations
| Limitation | Explanation |
|---|---|
| Shared Link | Inter-VLAN traffic shares the router-switch connection |
| Performance | Throughput depends on router and interface capabilities |
| Single Point of Failure | Router or trunk failure can stop inter-VLAN communication |
| Scalability | Large numbers of VLANs can become difficult to manage |
| Traffic Path | Inter-VLAN traffic must travel through the external router |
| Redundancy | Additional design is required for resilient routing |
Bandwidth Consideration
Suppose the router and switch are connected using a 1 Gbps full-duplex interface.
Traffic travelling from VLAN 10 to VLAN 20:
- Crosses the trunk toward the router.
- Is routed by the router.
- Crosses the trunk again toward VLAN 20.
Ethernet full-duplex allows simultaneous transmission and reception, but each direction is still limited by the interface capacity.
Heavy inter-VLAN traffic can therefore make the shared connection a bottleneck.
Inter-VLAN Security
VLANs separate Layer 2 broadcast domains, but VLAN separation alone does not automatically prevent communication after Layer 3 routing is enabled.
Without filtering, a router can normally route between directly connected VLAN networks.
Access Control Lists can restrict selected traffic.
For example, the following ACL blocks traffic originating from VLAN 10 and destined for VLAN 20:
configure terminal
ip access-list extended BLOCK_FINANCE_TO_HR
deny ip 192.168.10.0 0.0.0.255 192.168.20.0 0.0.0.255
permit ip any any
exit
interface GigabitEthernet0/0.10
ip access-group BLOCK_FINANCE_TO_HR in
exit
end
Router-on-a-Stick vs Layer 3 Switch
A Layer 3 switch can perform inter-VLAN routing internally using Switch Virtual Interfaces (SVIs).
| Feature | Router-on-a-Stick | Layer 3 Switch |
|---|---|---|
| VLAN Gateway | Router subinterface | SVI |
| Routing Location | External router | Switch |
| VLAN Transport | Shared trunk to router | Internal switching/routing |
| Performance | Depends on router and trunk | Often optimized for LAN forwarding |
| Scalability | Better for smaller deployments | Better for larger switched environments |
| Typical Use | Labs, branches, small networks | Campus and enterprise networks |

Where Router-on-a-Stick Is Useful
Router-on-a-Stick is commonly useful in:
- Networking labs
- CCNA training
- Small offices
- Branch environments
- Test networks
- Low-to-moderate traffic networks
- Environments without Layer 3 switching
Key Takeaways
Core Concept
- Router-on-a-Stick provides inter-VLAN routing using one physical router interface.
- Logical subinterfaces represent individual VLANs.
- Each user VLAN normally uses its router subinterface IP address as the default gateway.
- Different VLANs represent different Layer 3 IP networks.
VLAN and Trunking
- Access ports normally carry traffic for one VLAN.
- A trunk transports multiple VLANs.
- IEEE 802.1Q identifies VLAN traffic across the trunk.
- Native VLAN configuration should match between trunk endpoints.
Configuration and Verification
- Create the required VLANs.
- Assign endpoint ports to the correct VLANs.
- Configure the router-facing switch port as a trunk.
- Create a router subinterface for each routed VLAN.
- Verify the VLANs, trunk, subinterfaces and routing table before troubleshooting higher layers.
Design and Security
- All inter-VLAN traffic shares the router-switch connection.
- Heavy traffic can create a performance bottleneck.
- VLAN segmentation does not automatically provide complete security isolation.
- ACLs or firewalls can enforce communication policies.
- Layer 3 switches are generally better suited to high-throughput inter-VLAN routing.
Router-on-a-Stick is one of the best technologies for learning how VLANs, Ethernet switching and IP routing work together.
It demonstrates an important networking principle:
Switches separate traffic into VLANs, while routers provide communication between different IP networks.
Router-on-a-Stick is especially useful for:
- Learning inter-VLAN routing
- Building networking labs
- Understanding 802.1Q
- Practicing Cisco configuration
- Understanding default gateways
- Troubleshooting VLAN connectivity
For larger or high-throughput environments, Layer 3 switching may provide a more scalable architecture.
Recommended Beginner Practice
Build the topology in Cisco Packet Tracer, GNS3 or EVE-NG.
Create:
- VLAN 10 — Finance
- VLAN 20 — HR
- VLAN 30 — IT
Configure the trunk and router subinterfaces.
First verify communication between all three VLANs.
Then intentionally create common problems:
- Remove VLAN 20 from the allowed VLAN list.
- Configure an incorrect VLAN ID on a router subinterface.
- Configure an incorrect default gateway on one PC.
- Shut down the router's physical interface.
- Create a native VLAN mismatch.
Use verification commands to identify and fix each problem.
Breaking and repairing the lab is one of the fastest ways to understand Router-on-a-Stick troubleshooting.
Useful Links and References
SanchitGurukul Static Resources
Official External References
Your feedback matters
Was this post helpful?
Discussion
0 approved comments
No approved comments yet. You can start the discussion below.
Leave a Comment
No login is required. Name and email are used for moderation/security. Your email is never displayed publicly. All comments require administrator approval.
Discover more from SanchitGurukul
Subscribe to get the latest posts sent to your email.
