switchport mode trunk
Switchport mode trunk
The switchport mode command allows us to configure the trunking operational mode on a Layer 2 interface on a Cisco IOS device. By entering the command switchport mode trunk we configure the interface to operate in trunk mode. A Layer 2 interface operating in trunk mode carries traffic for multiple VLANs.
Frames egressing (exiting) a trunk mode interface are tagged with an 802.1Q tag specifying the VLAN to which the frame belongs. For a trunk interface, one VLAN may be specified as the native VLAN. Outoging frames belonging to the native VLAN are not tagged with a VLAN-ID tag.
Let's take a look at an example:
trunk | Set trunking mode to ACCESS unconditionally | |
dynamic | Set trunking mode to dynamically negotiate trunk or trunk mode | |
trunk | Set trunking mode to TRUNK unconditionally |
The context sensitive help shows us that the options for the switchport mode command include:
- trunk
- dynamic
- trunk
We can use this command to set the interface to operate in trunk mode as follows:
trunk | Set trunking mode to ACCESS unconditionally | |
dynamic | Set trunking mode to dynamically negotiate trunk or trunk mode | |
trunk | Set trunking mode to TRUNK unconditionally |
The switchport mode trunk command may be followed by the commands:
By default, a trunk interface will carry traffic for all the VLANs defined on a switch. The switchport trunk allowed vlan command can be used to customize the list of VLANs that a trunk interface belongs to.
By default, the native (untagged) VLAN for a trunk interface is the default interface (VLAN 1). The switchport trunk native vlan command can be used to set the native VLAN for a trunk interface to a VLAN other than the default VLAN.
VLANs, trunking, VLAN tagging and inter-vlan routing are covered comprehensively in the following interactive course: Course 5 - VLANs & Trunks. The course features visual, animated explanations and hands-on interactive labs.
Want to test your networking skills with hands-on configuration and troubleshooting questions? Try out the Workshops section of this website here: Workshops (Login required).
Read how to use the device simulators on this website here: Workshops - General Instructions