Objective
Configure a trunk link between two switches to allow VLAN traffic to pass between them. Verify the trunk status and allowed VLANs.
Lab Topology
Topology: SW1 (Gi0/1) connected to SW2 (Gi0/1)
Task 1 – Create VLANs
Create VLAN 10 and VLAN 20 on both switches.
SW1(config)# vlan 10 SW1(config-vlan)# name Sales SW1(config-vlan)# vlan 20 SW1(config-vlan)# name HR ! Repeat on SW2
Task 2 – Configure Trunk on SW1
Configure the interface connecting to SW2 as a trunk port.
SW1(config)# interface gigabitEthernet 0/1 SW1(config-if)# switchport trunk encapsulation dot1q ! If using L3 Switch SW1(config-if)# switchport mode trunk SW1(config-if)# switchport trunk native vlan 99 SW1(config-if)# no shutdown
Task 3 – Configure Trunk on SW2
SW2(config)# interface gigabitEthernet 0/1 SW2(config-if)# switchport trunk encapsulation dot1q SW2(config-if)# switchport mode trunk SW2(config-if)# switchport trunk native vlan 99 SW2(config-if)# no shutdown
Task 4 – Verification
Verify that the port is in trunking mode and check which VLANs are allowed.
SW1# show interfaces trunk Port Mode Encapsulation Status Native vlan Gi0/1 on 802.1q trunking 99 Port Vlans allowed on trunk Gi0/1 1-4094 Port Vlans in spanning tree forwarding state and not pruned Gi0/1 1,10,20,99