VLAN Trunks
Summary
This topic configure a trunk port on a LAN switch. Start learning CCNA 200-301 for free right now!!
Table of Contents
Trunk Configuration Commands
Now that you have configured and verified VLANs, it is time to configure and verify VLAN trunks. A VLAN trunk is a Layer 2 link between two switches that carries traffic for all VLANs (unless the allowed VLAN list is restricted manually or dynamically).
To enable trunk links, configure the interconnecting ports with the set of interface configuration commands shown in the table.
Task | IOS Command |
---|---|
Enter global configuration mode. |
Switch# configure terminal |
Enter interface configuration mode. |
Switch(config)# interface interface-id |
Set the port to permanent trunking mode. |
Switch(config-if)# switchport mode trunk |
Sets the native VLAN to something other than VLAN 1. |
Switch(config-if)# switchport trunk native vlan vlan-id |
Specify the list of VLANs to be allowed on the trunk link. |
Switch(config-if)# switchport trunk allowed vlan vlan-list |
Return to the privileged EXEC mode. |
Switch(config-if)# end |
Trunk Configuration Example
In the figure, VLANs 10, 20, and 30 support the Faculty, Student, and Guest computers (PC1, PC2, and PC3). The F0/1 port on switch S1 is configured as a trunk port and forwards traffic for VLANs 10, 20, and 30. VLAN 99 is configured as the native VLAN.
The subnets associated with each VLAN are:
- VLAN 10 – Faculty/Staff – 172.17.10.0/24
- VLAN 20 – Students – 172.17.20.0/24
- VLAN 30 – Guests – 172.17.30.0/24
- VLAN 99 – Native – 172.17.99.0/24
The example shows the configuration of port F0/1 on switch S1 as a trunk port. The native VLAN is changed to VLAN 99 and the allowed VLAN list is restricted to 10, 20, 30, and 99.
S1(config)# interface fastEthernet 0/1 S1(config-if)# switchport mode trunk S1(config-if)# switchport trunk native vlan 99 S1(config-if)# switchport trunk allowed vlan 10,20,30,99 S1(config-if)# end
Verify Trunk Configuration
The switch output displays the configuration of switch port F0/1 on switch S1. The configuration is verified with the show interfaces interface-ID switchport command.
S1# show interfaces fa0/1 switchport Name: Fa0/1 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 99 (VLAN0099) Administrative Native VLAN tagging: enabled Voice VLAN: none Administrative private-vlan host-association: none Administrative private-vlan mapping: none Administrative private-vlan trunk native VLAN: none Administrative private-vlan trunk Native VLAN tagging: enabled Administrative private-vlan trunk encapsulation: dot1q Administrative private-vlan trunk normal VLANs: none Administrative private-vlan trunk associations: none Administrative private-vlan trunk mappings: none Operational private-vlan: none Trunking VLANs Enabled: ALL Pruning VLANs Enabled: 2-1001 (output omitted)
The top highlighted area shows that port F0/1 has its administrative mode set to trunk. The port is in trunking mode. The next highlighted area verifies that the native VLAN is VLAN 99. Further down in the output, the bottom highlighted area shows that VLANs 10, 20, 30, and 99 are enabled on the trunk.
Reset the Trunk to the Default State
Use the no switchport trunk allowed vlan and the no switchport trunk native vlan commands to remove the allowed VLANs and reset the native VLAN of the trunk. When it is reset to the default state, the trunk allows all VLANs and uses VLAN 1 as the native VLAN. The example shows the commands used to reset all trunking characteristics of a trunking interface to the default settings.
S1(config)# interface fa0/1 S1(config-if)# no switchport trunk allowed vlan S1(config-if)# no switchport trunk native vlan S1(config-if)# end
The show interfaces f0/1 switchport
command reveals that the trunk has been reconfigured to a default state.
S1# show interfaces fa0/1 switchport Name: Fa0/1 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Administrative Native VLAN tagging: enabled Voice VLAN: none Administrative private-vlan host-association: none Administrative private-vlan mapping: none Administrative private-vlan trunk native VLAN: none Administrative private-vlan trunk Native VLAN tagging: enabled Administrative private-vlan trunk encapsulation: dot1q Administrative private-vlan trunk normal VLANs: none Administrative private-vlan trunk associations: none Administrative private-vlan trunk mappings: none Operational private-vlan: none Trunking VLANs Enabled: ALL Pruning VLANs Enabled: 2-1001 (output omitted)
This sample output shows the commands used to remove the trunk feature from the F0/1 switch port on switch S1. The show interfaces f0/1 switchport command reveals that the F0/1 interface is now in static access mode.
S1(config)# interface fa0/1 S1(config-if)# switchport mode access S1(config-if)# end S1# show interfaces fa0/1 switchport Name: Fa0/1 Switchport: Enabled Administrative Mode: static access Operational Mode: static access Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: native Negotiation of Trunking: Off Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Administrative Native VLAN tagging: enabled (output omitted)
Packet Tracer – Configure Trunks
In this Packet Tracer activity, you will perform the following:
- Verify VLANs
- Configure Trunks
Lab – Configure VLANs and Trunking
In this lab, you will perform the following:
- Build the Network and Configure Basic Device Settings
- Create VLANs and Assign Switch Ports
- Maintain VLAN Port Assignments and the VLAN Database
- Configure an 802.1Q Trunk between the Switches
- Delete the VLAN Database
Ready to go! Keep visiting our networking course blog, give Like to our fanpage; and you will find more tools and concepts that will make you a networking professional.