switchport mode trunk
Configures a switch interface as a trunk port, allowing multiple VLANs to traverse the link using IEEE 802.1Q tagging.
switchport mode trunkWhen to Use This Command
- Connecting two switches to carry traffic for multiple VLANs between them.
- Connecting a switch to a router for inter-VLAN routing (router-on-a-stick).
- Connecting a switch to a server that supports 802.1Q trunking for VLAN tagging.
- Connecting a switch to a wireless LAN controller that requires trunk links for multiple SSID VLANs.
Command Examples
Basic trunk configuration on an interface
interface GigabitEthernet0/1
switchport mode trunkSwitch(config-if)# switchport mode trunk Switch(config-if)#
The command is entered in interface configuration mode. No output is shown if successful; the prompt returns without error.
Verifying trunk status after configuration
show interfaces trunkPort Mode Encapsulation Status Native vlan Gi0/1 on 802.1q trunking 1 Port Vlans allowed on trunk Gi0/1 1-4094 Port Vlans allowed and active in management domain Gi0/1 1,10,20,30 Port Vlans in spanning tree forwarding state and not pruned Gi0/1 1,10,20,30
The output shows that Gi0/1 is in trunking mode with 802.1Q encapsulation. The native VLAN is 1. All VLANs (1-4094) are allowed, but only VLANs 1,10,20,30 are active and forwarding.
Understanding the Output
The 'show interfaces trunk' command displays trunk status. The 'Port' column lists the interface. 'Mode' shows the trunking mode: 'on' means trunking is enabled statically, 'desirable' or 'auto' are DTP modes. 'Encapsulation' is always 802.1q for modern switches. 'Status' should be 'trunking' for a working trunk; if it says 'not-trunking', the link is not trunking. 'Native vlan' shows the untagged VLAN (default 1). The second section lists all VLANs allowed on the trunk; by default it's 1-4094. The third section shows VLANs that are actually active and allowed; if a VLAN is not in this list, it may not exist or be shut down. The last section shows VLANs that are in spanning-tree forwarding state; if a VLAN is missing, STP may be blocking it. A common issue is mismatched native VLANs, which can cause errors; both ends must match.
CCNA Exam Tips
CCNA exam tip: The 'switchport mode trunk' command statically sets the interface to trunk, disabling DTP negotiation. Remember that DTP is Cisco proprietary and not used on non-Cisco switches.
CCNA exam tip: If you see 'switchport mode dynamic desirable' or 'auto', the interface can become a trunk via DTP. The exam may ask which mode forms a trunk with a static trunk.
CCNA exam tip: The native VLAN must match on both ends of a trunk; otherwise, VLAN hopping or misconfiguration can occur. The default native VLAN is 1.
CCNA exam tip: To restrict which VLANs are allowed on a trunk, use 'switchport trunk allowed vlan' command. The exam may test that only specific VLANs are permitted.
Common Mistakes
Mistake: Forgetting to set the interface to trunk mode before configuring trunk-specific commands like allowed VLANs or native VLAN. The interface will remain in access mode and commands may be rejected.
Mistake: Configuring trunk mode on an interface connected to an end device (PC, printer) that does not support trunking, causing the device to not communicate.
Mistake: Mismatched native VLANs on both ends of the trunk, leading to VLAN leakage or connectivity issues.
Related Commands
show interfaces trunk
Displays trunk interface status, allowed VLANs, and pruning information for all trunk ports on a Cisco switch, used to verify trunking configuration and VLAN membership.
switchport mode access
Configures a switch interface as an access port, placing it in a single VLAN and removing any trunking functionality.
switchport trunk allowed vlan [list]
Restricts the VLANs that are allowed to traverse a trunk link on a Cisco switch, used to control which VLAN traffic is permitted on the trunk.
switchport trunk native vlan [id]
Configures the native VLAN for an 802.1Q trunk interface, specifying which VLAN's frames are sent untagged on the trunk.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions