New here? Start with our CCNA Foundations skill path to build a solid networking base.

CCNA
Beginner

VLANs + Trunks + Inter-VLAN Routing

Overview

Learn the fundamentals of VLANs, trunk configuration, and routing between VLANs using a router-on-a-stick or Layer 3 switch.

Prerequisites

Basic switch configuration, IP addressing knowledge

Topology

Two switches connected via trunk link, one router with subinterfaces for inter-VLAN routing. Three VLANs (10, 20, 30) with PCs in each VLAN.

VLAN
Trunking
Inter-VLAN Routing
Switching

Lab Steps

Step 1Create VLANs on switches

Create VLAN 10 (Sales), VLAN 20 (Engineering), and VLAN 30 (Management) on both switches.

vlan 10
name Sales
vlan 20
name Engineering
vlan 30
name Management

Checklist:

  • VLANs created on SW1
  • VLANs created on SW2
  • VLAN names configured
Step 2Assign ports to VLANs
Step 3Configure trunk between switches
Step 4Configure router subinterfaces

Configurations

Switch VLAN Configuration
SW1
SW1cisco
vlan 10
 name Sales
vlan 20
 name Engineering
vlan 30
 name Management
!
interface fa0/1
 switchport mode access
 switchport access vlan 10
!
interface fa0/24
 switchport mode trunk
 switchport trunk allowed vlan 10,20,30
Router Subinterface Configuration
Router1
Router1cisco
interface g0/0.10
 encapsulation dot1Q 10
 ip address 192.168.10.1 255.255.255.0
!
interface g0/0.20
 encapsulation dot1Q 20
 ip address 192.168.20.1 255.255.255.0
!
interface g0/0.30
 encapsulation dot1Q 30
 ip address 192.168.30.1 255.255.255.0

Verification

Verify VLAN creation

Commandscisco
show vlan brief
show interfaces trunk

Expected Output:

Outputcisco
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
10   Sales                            active    Fa0/1, Fa0/2
20   Engineering                      active    Fa0/3, Fa0/4

Test inter-VLAN connectivity

Commandscisco
ping 192.168.20.10
show ip route

Expected Output:

Outputcisco
Success rate is 100 percent (5/5)

Common Issues