Packet Tracer Phase 2: VLANs, 802.1Q Trunking & Inter-VLAN Routing
Building enterprise multi-VLAN topologies, switch trunk links, Router-on-a-Stick (ROAS), and router DHCP pools.
In corporate networks (like NUST or a bank), finance staff, ICT admins, and guest users cannot sit on the same broadcast domain. We use VLANs to logically isolate traffic on shared switches, and a Router (or Layer 3 Switch) to securely route traffic between them.
1. Step-by-Step Lab: VLAN Creation & Access Port Setup
! Step 1: Open Switch CLI -> Enter Global Configuration Mode
Switch> enable
Switch# configure terminal
! Step 2: Create VLAN 10 for ADMIN Department
Switch(config)# vlan 10
Switch(config-vlan)# name ADMIN_DEPT
Switch(config-vlan)# exit
! Step 3: Create VLAN 20 for STUDENTS
Switch(config)# vlan 20
Switch(config-vlan)# name STUDENT_LABS
Switch(config-vlan)# exit
! Step 4: Assign Ports 1-10 to VLAN 10 (Access Mode)
Switch(config)# interface range FastEthernet 0/1 - 10
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 10
Switch(config-if-range)# exit
! Step 5: Assign Ports 11-20 to VLAN 20 (Access Mode)
Switch(config)# interface range FastEthernet 0/11 - 20
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 20
Switch(config-if-range)# end
! Step 6: Verify VLAN Port Membership
Switch# show vlan brief
2. Configuring 802.1Q Trunk Links Between Switches
When connecting two switches together (e.g. Switch-Floor1 to Switch-Floor2), the link connecting them must be configured as a Trunk Port so it can carry tagged frames for both VLAN 10 and VLAN 20 simultaneously.
Switch(config)# interface GigabitEthernet 0/1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20
Switch(config-if)# switchport trunk native vlan 99
Switch(config-if)# no shutdown
Switch(config-if)# end
3. Configuring Router-on-a-Stick (ROAS) & Router DHCP Server
Because VLAN 10 (`192.168.10.0/24`) and VLAN 20 (`192.168.20.0/24`) sit on different logical subnets, they cannot talk to each other without a Layer 3 router gateway. We use sub-interfaces on a single physical router port (`Gi0/0/0`):
Router> enable
Router# configure terminal
! Enable Physical Interface without IP address
Router(config)# interface GigabitEthernet 0/0/0
Router(config-if)# no shutdown
Router(config-if)# exit
! Configure Sub-interface for VLAN 10 (ADMIN Gateway)
Router(config)# interface GigabitEthernet 0/0/0.10
Router(config-subif)# encapsulation dot1Q 10
Router(config-subif)# ip address 192.168.10.1 255.255.255.0
Router(config-subif)# exit
! Configure Sub-interface for VLAN 20 (STUDENTS Gateway)
Router(config)# interface GigabitEthernet 0/0/0.20
Router(config-subif)# encapsulation dot1Q 20
Router(config-subif)# ip address 192.168.20.1 255.255.255.0
Router(config-subif)# exit
! Configure DHCP Pool for ADMIN Workstations
Router(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10
Router(config)# ip dhcp pool ADMIN_POOL
Router(dhcp-config)# network 192.168.10.0 255.255.255.0
Router(dhcp-config)# default-router 192.168.10.1
Router(dhcp-config)# dns-server 8.8.8.8
Router(dhcp-config)# end