Lab 4: Inter-VLAN Routing (Router-on-a-Stick)
Time to connect the VLANs: one router interface, split into dot1q subinterfaces, routes between VLAN 10 and VLAN 20 over a single trunk — the classic router-on-a-stick. Difficulty: Intermediate · Time: ~30 min.
Lab objectives
- Trunk the switch port facing the router
- Create a subinterface per VLAN with encapsulation dot1q
- Set PC gateways to the subinterface IPs
- Prove inter-VLAN ping works
Topology & addressing
Devices: 1× 2911 router, 1× 2960 switch (Gi0/1 → router Gi0/0), PCs in VLAN 10 (192.168.10.11, gateway .1) and VLAN 20 (192.168.20.11, gateway .1). Switch as per Labs 2–3 with Gi0/1 trunked.
Step-by-step configuration
interface gi0/0no shutdown | Bring up the physical interface (no IP on it) |
interface gi0/0.10encapsulation dot1q 10ip address 192.168.10.1 255.255.255.0 | Subinterface = VLAN 10 gateway |
interface gi0/0.20encapsulation dot1q 20ip address 192.168.20.1 255.255.255.0 | Subinterface = VLAN 20 gateway |
Verification
show ip interface brief — both subinterfaces up with IPs. From PC1 (VLAN 10): ping 192.168.10.1 (gateway), then ping 192.168.20.11 — the inter-VLAN ping now succeeds. Compare with Lab 2 where it failed: that difference is routing.
Done? Try the next lab on the labs hub, or test your knowledge on the free CCNA practice test. Get Packet Tracer free via the career hub.
Frequently asked questions
Why doesn't the physical router interface get an IP?
The physical interface only carries the trunk; each dot1q subinterface holds the IP for its VLAN and acts as that VLAN's gateway.
What does encapsulation dot1q 10 mean?
It tells the subinterface to send/receive frames tagged with VLAN 10 on the trunk.
Is router-on-a-stick used in real networks?
Yes in small networks; larger ones use Layer 3 switches with SVIs for higher throughput — the concept is identical.
Related articles
Want hands-on training?
Learn this on real Cisco lab devices with placement support at Attila Technologies, Ahmedabad.