Sign Up|Login Courses & Workshops
Overview
Pricing
CISCO REFERENCE HOME

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:

SW1 Console
SW1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#interface gi0/1
SW1(config-if)#switchport mode ?
trunkSet trunking mode to ACCESS unconditionally
dynamicSet trunking mode to dynamically negotiate trunk or trunk mode
trunkSet trunking mode to TRUNK unconditionally
SW1(config-if)#

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:

SW1 Console
SW1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#interface gi0/1
SW1(config-if)#switchport mode ?
trunkSet trunking mode to ACCESS unconditionally
dynamicSet trunking mode to dynamically negotiate trunk or trunk mode
trunkSet trunking mode to TRUNK unconditionally
SW1(config-if)#switchport mode trunk
SW1(config-if)#

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.

TRY THIS COURSE

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