Lab 1: InterVLAN Routing — Router-on-a-Stick

Click any device to open its CLI

← Back to Labs
PC1
VLAN 10 | 192.168.10.10
PC2
VLAN 20 | 192.168.20.10
SW1
Cisco 2960
R1
Cisco ISR
Lab 1 — InterVLAN Routing
Scenario
You've been assigned to set up the new sales and HR departments at NovaTech Inc. Both teams share the same switch (SW1) but need to be on separate networks for security. The sales team needs VLAN 10 and the HR team needs VLAN 20. Since both VLANs need internet access through R1, you'll need to configure a trunk link and router subinterfaces — the classic router-on-a-stick setup.
DeviceInterfaceIP / ConfigDetails
PC1Eth0192.168.10.10/24GW: 192.168.10.1
PC2Eth0192.168.20.10/24GW: 192.168.20.1
SW1Fa0/1Access VLAN 10To PC1
SW1Fa0/2Access VLAN 20To PC2
SW1Fa0/24Trunk (802.1Q)To R1
R1Fa0/0.10192.168.10.1/24VLAN 10 gateway
R1Fa0/0.20192.168.20.1/24VLAN 20 gateway
Mission: Configure VLANs, access ports, trunk, and router subinterfaces so PC1 and PC2 can ping each other through R1.
Tasks
1
Create VLAN 10 (SALES) and VLAN 20 (HR) on SW1
Nudge

You need: vlan and name commands in global config mode.

More Detail

On SW1, enter privileged EXEC (enable), then configure terminal. Use vlan 10 to create VLAN 10, name SALES to name it, then exit. Repeat for VLAN 20 with name HR.

Full Solution
enable configure terminal vlan 10 name SALES exit vlan 20 name HR exit
2
Assign Fa0/1 as access port in VLAN 10 and Fa0/2 in VLAN 20
Nudge

Commands: interface, switchport mode access, switchport access vlan

More Detail

Enter each interface, set it to access mode, then assign the VLAN. Fa0/1 connects to PC1 (VLAN 10), Fa0/2 connects to PC2 (VLAN 20). Access ports carry only one VLAN's traffic.

Full Solution
interface fa0/1 switchport mode access switchport access vlan 10 exit interface fa0/2 switchport mode access switchport access vlan 20 exit
VLANs must exist before you can assign ports to them. If you get an error, create the VLANs first (Task 1).
3
Configure Fa0/24 as an 802.1Q trunk port on SW1
Nudge

You need: interface and switchport mode trunk

More Detail

The link between SW1 (Fa0/24) and R1 must carry multiple VLANs. Set the port to trunk mode so it uses 802.1Q tagging.

Full Solution
interface fa0/24 switchport mode trunk end
Trunk ports use 802.1Q tagging to carry traffic for multiple VLANs over a single physical link.
4
Create subinterface Fa0/0.10 on R1 — encapsulation dot1Q 10, IP 192.168.10.1/24
Nudge

Commands: interface fa0/0.10, encapsulation dot1q, ip address

More Detail

On R1, create subinterface Fa0/0.10. The encapsulation dot1q 10 command maps it to VLAN 10. Then assign IP 192.168.10.1 with mask 255.255.255.0 — this becomes the default gateway for VLAN 10.

Full Solution
enable configure terminal interface fa0/0.10 encapsulation dot1q 10 ip address 192.168.10.1 255.255.255.0 exit
The subinterface number (.10) is just a label — the encapsulation dot1q command is what actually maps it to VLAN 10.
5
Create subinterface Fa0/0.20 on R1 — encapsulation dot1Q 20, IP 192.168.20.1/24
Nudge

Same pattern as Task 4 — different VLAN and IP.

More Detail

Create Fa0/0.20, encapsulate for VLAN 20, and assign IP 192.168.20.1/24.

Full Solution
interface fa0/0.20 encapsulation dot1q 20 ip address 192.168.20.1 255.255.255.0 exit
6
Bring up the physical interface Fa0/0 on R1
Nudge

You need: interface fa0/0 and no shutdown

More Detail

Subinterfaces inherit the up/down state of the physical interface. You must bring up Fa0/0 for the subinterfaces (.10 and .20) to function.

Full Solution
interface fa0/0 no shutdown end
Always remember to bring up the parent physical interface — subinterfaces won't work without it.
7
Verify end-to-end: ping 192.168.20.10 from PC1
Nudge

Click on PC1 and use the ping command.

More Detail

Open PC1's command prompt. Ping PC2's IP (192.168.20.10). If all VLANs, access ports, trunk, and subinterfaces are correctly configured, the ping should succeed.

Full Solution
ping 192.168.20.10

Expected: 4 replies from 192.168.20.10. If it fails, verify with show vlan brief on SW1 and show ip interface brief on R1.

The traffic path: PC1 -> SW1 Fa0/1 (access VLAN 10) -> SW1 Fa0/24 (trunk) -> R1 Fa0/0.10 -> R1 routes to Fa0/0.20 -> SW1 trunk -> SW1 Fa0/2 (access VLAN 20) -> PC2.
Device CLI
>

Lab Complete!

InterVLAN routing is working. PC1 (VLAN 10) and PC2 (VLAN 20) can now communicate through the router-on-a-stick configuration at NovaTech Inc.

Back to Lab Portal