Week 5 · Lab

LAB: VLAN, Trunk, Inter-VLAN Routing

Three lessons, one topology: this lab builds two switches and a router, creates VLANs 10 and 20, assigns access ports, joins the switches with an 802.1Q trunk, and finally makes the two VLANs talk through router-on-a-stick inter-VLAN routing. If you complete the checks at the end, you have just assembled the standard small-office switched network — and every command you type is exam-relevant.

CCNA 200-301 Domain 2.0 · Network Access Verified 2026-10-11
Learning objectives
Part 1

Overview and goal

Two switches, S1 and S2, each host one PC. PC-A is in VLAN 10 (192.168.10.0/24) and PC-C is in VLAN 20 (192.168.20.0/24). The switches are linked by a trunk over which both VLANs ride, and router R1 terminates that trunk with subinterfaces to provide the default gateways. The goal has two parts:

The whole lab is the “same-VLAN reachable, cross-VLAN routed” pattern in miniature.

In this lesson · select a part to jump

Part 2

Topology

PC-A VLAN 10 S1 Gi0/1-2, Gi0/24 S2 Gi0/2, Gi0/24 PC-C VLAN 20 R1 Gi0/0.10 and .20 trunk 802.1Q — VLAN 10 + 20 trunk to R1
The two switches share a trunk; R1 terminates the same trunk from S1. VLAN 10 hosts reach VLAN 20 hosts only through R1’s subinterfaces.
Part 3

Addressing plan

DeviceInterfaceVLANIP address / prefixGateway
PC-ANIC10192.168.10.10 /24192.168.10.1
PC-CNIC20192.168.20.10 /24192.168.20.1
S1—10, 20——
S2—10, 20——
R1Gi0/0.1010192.168.10.1 /24—
R1Gi0/0.2020192.168.20.1 /24—
Reference table · select a row

Part 4

Step 1 — Build the topology

In Packet Tracer (or GNS3/EVE-NG), place one router (R1, e.g. 4321), two switches, and two PCs. Cable as shown: PC-A to S1 Gi0/1, S1 Gi0/24 to S2 Gi0/24, S2 Gi0/2 to PC-C, and S1 Gi0/24 also to R1 Gi0/0 (— in Packet Tracer connect R1 Gi0/0 to switch port Gi0/24 or a spare like Gi0/23; the exact ports only need to match what you configure in the steps). Keep the hostname discipline from earlier labs: every device gets a name before its services.

Router> enable
Router# configure terminal
Router(config)# hostname R1
R1(config)# interface gigabitEthernet 0/0
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# end

Switch> enable
Switch# configure terminal
Switch(config)# hostname S1
S1(config)# end

Switch# configure terminal
Switch(config)# hostname S2
S2(config)# end
Part 5

Step 2 — Configure host PCs

Give PC-A and PC-C their addresses and gateways from the table. In Packet Tracer the sequence is: click the PC → Desktop → IP Configuration, fill in IP, mask, and default gateway, and close.

PC-A → IP 192.168.10.10  mask 255.255.255.0  gateway 192.168.10.1
PC-C → IP 192.168.20.10  mask 255.255.255.0  gateway 192.168.20.1
Part 6

Step 3 — Create the VLANs on S1

S1# configure terminal
S1(config)# vlan 10
S1(config-vlan)# name Students
S1(config-vlan)# exit
S1(config)# vlan 20
S1(config-vlan)# name Staff
S1(config-vlan)# exit

Lesson 13 revisited on hardware: the VLANs exist but carry nothing until ports join them.

Part 7

Step 4 — Assign access ports on S1

S1(config)# interface gigabitEthernet 0/1
S1(config-if)# switchport mode access
S1(config-if)# switchport access vlan 10
S1(config-if)# exit

PC-A’s port is now an access port in VLAN 10. Verify before moving on:

S1# show vlan brief
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi0/3, Gi0/4, Gi0/5, Gi0/6
10   Students                         active    Gi0/1
20   Staff                            active
Part 8

Step 5 — Configure S2

Repeat the VLAN creation on S2 (VLANs 10 and 20 with the same names), then put PC-C’s port into VLAN 20:

S2# configure terminal
S2(config)# vlan 10
S2(config-vlan)# name Students
S2(config-vlan)# exit
S2(config)# vlan 20
S2(config-vlan)# name Staff
S2(config-vlan)# exit
S2(config)# interface gigabitEthernet 0/2
S2(config-if)# switchport mode access
S2(config-if)# switchport access vlan 20
S2(config-if)# end
Part 9

Step 6 — Build the trunk

Now connect the two switches with a trunk carrying both VLANs. Configure Gi0/24 on each switch. Setting the allowed list explicitly is good practice — it keeps future VLAN 30 from wandering onto this link by accident:

S1(config)# interface gigabitEthernet 0/24
S1(config-if)# switchport mode trunk
S1(config-if)# switchport trunk allowed vlan 10,20
S1(config-if)# end

S2(config)# interface gigabitEthernet 0/24
S2(config-if)# switchport mode trunk
S2(config-if)# switchport trunk allowed vlan 10,20
S2(config-if)# end

S1# show interfaces trunk
Port        Mode         Encapsulation  Status        Native vlan
Gi0/24      on           802.1q         trunking      1
Port        Vlans allowed on trunk
Gi0/24      10,20
Note Both ends of a trunk must allow the same VLANs, and the 802.1q encapsulation appears automatically when the mode is trunk. Native VLAN remains 1 here because we left the default — acceptable in a lab, and a perfect reminder of Lesson 14’s “native = untagged” fact.
Key ideas & exam traps · select one

Part 10

Step 7 — Set up router-on-a-stick on R1

The router terminates the trunk from S1. Split Gi0/0 into two subinterfaces — one per VLAN — and give each its gateway address. The physical interface must be up (we enabled it in Step 1), and its IP address lives on the subinterfaces, never on Gi0/0 itself:

R1(config)# interface gigabitEthernet 0/0.10
R1(config-subif)# encapsulation dot1q 10
R1(config-subif)# ip address 192.168.10.1 255.255.255.0
R1(config-subif)# exit

R1(config)# interface gigabitEthernet 0/0.20
R1(config-subif)# encapsulation dot1q 20
R1(config-subif)# ip address 192.168.20.1 255.255.255.0
R1(config-subif)# end

If your trunk also used a non-default native VLAN, one subinterface would need the encapsulation dot1q <id> native form — not required here since the native VLAN is 1 and no subinterface claims it.

Part 11

Step 8 — Verify: show commands and pings

Run the verification chain in order. Each check reflects one lesson:

S1# show vlan brief             ! Lesson 13: ports in the right VLANs
S1# show interfaces trunk        ! Lesson 14: trunk up, allowed list correct
R1# show ip interface brief       ! Lesson 15: both subinterfaces up
R1# show ip route                 ! connected 192.168.10.0/24 and 192.168.20.0/24

Then the functional tests, from the hosts:

C:\> ping 192.168.20.10
Reply from 192.168.20.10: bytes=32 time=1ms TTL=127
Reply from 192.168.20.10: bytes=32 time=1ms TTL=127

When PC-A pings PC-C, the packet rides VLAN 10 to the trunk, reaches R1 on subinterface .10, is routed out subinterface .20, and is re-encapsulated into a VLAN 20 frame at S2 for PC-C. Two good negative tests complete the picture:

Part 12

Step 9 — Troubleshooting guide

SymptomLikely causeFix
PC-A ping fails but S1↔S1 trunk is upPort never assigned to VLAN (still VLAN 1)switchport mode access + switchport access vlan 10, re-check show vlan brief
Trunk shows but allowed list misses a VLANAllowed list pruned too farswitchport trunk allowed vlan 10,20 on both ends
Subinterfaces up, hosts in same VLAN can’t ping each other across switchesVLAN missing on the other switch or trunk not carrying itCreate VLAN on both switches; verify show interfaces trunk
Host can’t reach its own gatewayWrong default gateway on the hostPC-A must use 192.168.10.1 (VLAN 10), PC-C must use 192.168.20.1
Router receives nothing on .10Physical Gi0/0 shut down, or encapsulation/subinterface mismatchno shutdown on Gi0/0; confirm encapsulation dot1q numbers match the VLANs
Exam tip This exact topology — two switches, one trunk, one router — is a perennial scenario item. Diagnose in this order: VLAN membership (show vlan brief), trunk health (show interfaces trunk), subinterfaces (show ip interface brief), then routing (show ip route). Hosts and gateways are always last, because they are the most obvious and the least often wrong.
Key terms

The vocabulary you need

Every term below appears in the lesson text above. Select one to read its definition, then use the quiz at the end to check what stuck.

Key terms · select a term

Part 13 · Your turn

Review

Check what you have learned with these review questions.

Review · 5 questions

Sources

Sources & references

  1. Cisco. CCNA (200-301) Exam Topics. cisco.com.
  2. IETF. Request for Comments (RFCs). rfc-editor.org.
  3. IANA. Internet Assigned Numbers Authority registries. iana.org.

Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.