AI Network Labs 04 — Lab: VLANs and Router-on-a-Stick
Two VLANs on one switch, an 802.1Q trunk and router subinterfaces as gateways — built by prompt, verified with show vlan and show interfaces trunk.
One switch, two departments that must not share a broadcast domain, one router that routes between them over a single trunk. This is the pattern behind every departmental VLAN in the capstone.
1 · Plan
| VLAN | Name | Subnet | Gateway (R1 subinterface) | Access ports |
|---|---|---|---|---|
| 10 | SALES | 10.0.10.0/24 | Gi0/0.10 — 10.0.10.1 | Fa0/1–2 |
| 20 | ENG | 10.0.20.0/24 | Gi0/0.20 — 10.0.20.1 | Fa0/3–4 |
Trunk: SW1 Gi0/1 ↔ R1 Gi0/0. PCs: PC-S1 .11, PC-S2 .12 in VLAN 10; PC-E1 .11, PC-E2 .12 in VLAN 20.
2 · Expected configuration
SW1
configure terminal
vlan 10
name SALES
vlan 20
name ENG
interface range FastEthernet0/1 - 2
switchport mode access
switchport access vlan 10
interface range FastEthernet0/3 - 4
switchport mode access
switchport access vlan 20
interface GigabitEthernet0/1
switchport mode trunk
switchport trunk allowed vlan 10,20
endR1
configure terminal
interface GigabitEthernet0/0
no shutdown
interface GigabitEthernet0/0.10
encapsulation dot1Q 10
ip address 10.0.10.1 255.255.255.0
interface GigabitEthernet0/0.20
encapsulation dot1Q 20
ip address 10.0.20.1 255.255.255.0
endThe physical interface carries no IP address — it only needs no shutdown. Each subinterface tags its traffic with encapsulation dot1Q <vlan>.
3 · Prompt
Build router-on-a-stick: R1 (2911), SW1 (2960-24TT), four PCs.
VLAN 10 SALES on Fa0/1-2 (10.0.10.0/24), VLAN 20 ENG on Fa0/3-4 (10.0.20.0/24).
Trunk SW1 Gi0/1 to R1 Gi0/0, allowed VLANs 10,20.
R1 subinterfaces Gi0/0.10 and Gi0/0.20 as the gateways (.1).
Show commands first. Then verify: PC-S1 → PC-S2 (same VLAN) and PC-S1 → PC-E1 (inter-VLAN).4 · Verify
show vlan brief
show interfaces trunk
show ip interface briefOn SW1, show vlan brief must list Fa0/1–2 under VLAN 10 and Fa0/3–4 under VLAN 20; show interfaces trunk must show Gi0/1 trunking 10 and 20.
Exercise
Remove VLAN 20 from the trunk's allowed list. Which pings fail, and which still work? Predict first, then ask the AI to test it.
ExerciseKnowledge check
What does 'encapsulation dot1Q 20' on Gi0/0.20 do?
Finished this one?
Progress is saved in this browser.
