free lab · CertCrack Packet Tracer Labs · All labs

Lab 4: Inter-VLAN Routing — Router-on-a-Stick

CCNA domain: Domain 3 · IP Connectivity (inter-VLAN routing)  ·  Difficulty: Intermediate  ·  Time: ~30 minutes  ·  Devices: 1 router (2911), 1 switch (2960), 3 PCs

Lab 3 ended with a hard limit: VLANs could not talk to each other. This lab removes it with the classic router-on-a-stick design — a single physical router interface carries all three VLANs over one trunk, while logical subinterfaces on the router act as the default gateway for each VLAN. You will reuse Lab 3's VLAN plan, add the router side, and finish with PCs pinging cleanly across VLAN boundaries for the first time.

Your progress on this lab

0 of 5 tasks done — tick tasks off as you finish them; progress is saved in this browser.

What you need

Topology

SW12960R12911PC0V10 · 192.168.10.11PC1V20 · 192.168.20.11PC2V30 · 192.168.30.11Fa0/24 — trunk — G0/0Fa0/1Fa0/2Fa0/3G0/0.10 → 192.168.10.1G0/0.20 → 192.168.20.1G0/0.30 → 192.168.30.1

R1's physical G0/0 gets no IP address of its own — it must simply be switched on. All addressing lives on the subinterfaces, one per VLAN, and each subinterface number matches its VLAN ID (G0/0.10 serves VLAN 10) — a convention worth copying, because it makes configurations self-documenting. The switch side is pure Lab 3: three access ports and one trunk.

DeviceInterfaceIP addressNotes
R1GigabitEthernet 0/0No IP — physical parentMust be no shutdown or every subinterface stays down
R1GigabitEthernet 0/0.10192.168.10.1 /24Gateway for VLAN 10 Sales
R1GigabitEthernet 0/0.20192.168.20.1 /24Gateway for VLAN 20 Engineering
R1GigabitEthernet 0/0.30192.168.30.1 /24Gateway for VLAN 30 Operations
SW1FastEthernet 0/1–0/3Access · VLANs 10, 20, 30One access port per PC
SW1FastEthernet 0/24Trunk · 802.1QTo R1 G0/0 — carries all three VLANs
PC0FastEthernet 0192.168.10.11 /24VLAN 10, gateway 192.168.10.1
PC1FastEthernet 0192.168.20.11 /24VLAN 20, gateway 192.168.20.1
PC2FastEthernet 0192.168.30.11 /24VLAN 30, gateway 192.168.30.1

Tasks

Build the topology first, then work through the tasks in order. Try each task from memory before you open the commands — that is how the skill sticks. Click Show commands only when you are stuck or to check your work.

Task 1 — Create the VLANs and access ports on SW1

The switch half is Lab 3 condensed: create VLANs 10 Sales, 20 Engineering and 30 Operations, then assign Fa0/1, Fa0/2 and Fa0/3 as access ports in VLANs 10, 20 and 30 respectively. If you kept your Lab 3 file you may rebuild from it — but typing it again is faster learning.

enable
configure terminal
vlan 10
name Sales
vlan 20
name Engineering
vlan 30
name Operations
interface fastEthernet 0/1
switchport mode access
switchport access vlan 10
interface fastEthernet 0/2
switchport mode access
switchport access vlan 20
interface fastEthernet 0/3
switchport mode access
switchport access vlan 30
exit

Task 2 — Trunk SW1's uplink to the router

The link to R1 must carry all three VLANs, so Fa0/24 becomes a trunk — the same command as Lab 3. There is no matching trunk command on the router; the router side expresses the same idea with encapsulation on subinterfaces, which is Task 3.

interface fastEthernet 0/24
switchport mode trunk
exit

Task 3 — Build the router subinterfaces

On R1: first enable the physical G0/0 (it gets no IP address). Then create one subinterface per VLAN. Order matters inside each subinterface: encapsulation dot1Q <vlan> must come before the IP address, because the encapsulation tells the router which tagged frames this subinterface owns. The subinterface number matching the VLAN ID is a convention, not a requirement — but follow it.

enable
configure terminal
interface gigabitEthernet 0/0
no shutdown
exit
interface gigabitEthernet 0/0.10
encapsulation dot1Q 10
ip address 192.168.10.1 255.255.255.0
exit
interface gigabitEthernet 0/0.20
encapsulation dot1Q 20
ip address 192.168.20.1 255.255.255.0
exit
interface gigabitEthernet 0/0.30
encapsulation dot1Q 30
ip address 192.168.30.1 255.255.255.0
exit

Task 4 — Address the PCs — this time with gateways

Set each PC's static address as before, but now fill in the Default Gateway: the subinterface address in the PC's own VLAN. This one field is the entire difference between Lab 3 and Lab 4 — it is how a PC reaches anything outside its VLAN.

PC IP settings (Desktop > IP Configuration, Static):
PC0: 192.168.10.11  mask 255.255.255.0  gateway 192.168.10.1
PC1: 192.168.20.11  mask 255.255.255.0  gateway 192.168.20.1
PC2: 192.168.30.11  mask 255.255.255.0  gateway 192.168.30.1

Task 5 — Ping across the VLAN boundaries

From PC0, ping PC1 and PC2. The packet path is new: PC0 sends the frame to its gateway, SW1 tags it up the trunk, R1 routes it from subinterface .10 to subinterface .20, and SW1 delivers it untagged to PC1. Expect the very first ping to drop a packet or two while ARP runs — repeat it and look for clean replies.

PC0 > Desktop > Command Prompt:
ping 192.168.20.11
ping 192.168.30.11
tracert 192.168.30.11

Verification

Run these checks from the device CLI (or a PC command prompt where noted). Your output should match the description — wording may vary slightly by Packet Tracer version.

Exam connection

Inter-VLAN routing anchors Domain 3 (IP Connectivity): the exam expects you to choose between router-on-a-stick, a Layer 3 switch with SVIs, and a router per VLAN — and to configure and troubleshoot the one in front of you. The failure modes in this lab are the exam's favorites: subinterface encapsulation set after the IP address, a missing no shutdown on the physical interface, or a PC gateway pointing at the wrong VLAN's subinterface. Build the muscle memory here, then check it against the free 30-question CCNA practice sample and the CCNA 200-301 guidebook.

Turn lab skills into exam marks

Router-on-a-stick is one of the most configurable — and most tested — CCNA designs. The free sample will show you how Cisco phrases the troubleshooting questions.

Free CCNA SampleCCNA Guidebook

FAQ

Why does the physical interface have no IP address?

In router-on-a-stick, the physical interface is just a carrier: it forwards tagged frames to and from the subinterfaces, and all Layer 3 identity lives on the subinterfaces. It still must be enabled with no shutdown — if the physical interface is down, every subinterface on it is down too, which is the first thing to check when 'nothing works'.

Must the subinterface number match the VLAN ID?

No — G0/0.99 could legally serve VLAN 10 if its encapsulation says dot1Q 10. The encapsulation command is what binds a subinterface to a VLAN; the number after the dot is only a label. Matching them anyway is standard practice because it makes show output and configurations readable at a glance.

When would you use a Layer 3 switch instead of router-on-a-stick?

When traffic volume grows. Router-on-a-stick pushes all inter-VLAN traffic up and down one link to one router interface — a bottleneck and a single point of failure. A Layer 3 switch routes between VLANs internally on SVIs (switch virtual interfaces) at wire speed, and is the modern default inside a campus LAN.

← Previous labLab 3: VLANs & 802.1Q Trunking Next lab →Lab 5: Static Routing & Default Route

More free tools

Packet Tracer LabsAll 10 free CCNA hands-on labs Subnet CalculatorNetwork, broadcast & host ranges from any IP/CIDR Subnetting PracticeTimed subnet drills with worked solutions OSI Model QuizLearn the 7 layers and test yourself All Free ToolsThe CertCrack tools hub