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

Understanding Cisco Dynamic Trunking Protocol (DTP)

The switchport mode command

The switchport mode command allows us to configure the opertional mode of a Layer 2 interface on a Cisco device. Using this command, we can statically configure an interface to operate in one of 2 modes - access or trunk. We can also use this command to configure an interface to dynamically negotiate an operational mode (trunk or access).

The different options available for this command are shown below:

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 ?
accessSet trunking mode to ACCESS unconditionally
dynamicSet trunking mode to dynamically negotiate access or trunk mode
trunkSet trunking mode to TRUNK unconditionally
SW1(config-if)#switchport mode dynamic ?
autoSet trunking mode dynamic negotiation parameter to AUTO
desirableSet trunking mode dynamic negotiation parameter to DESIRABLE
SW1(config-if)#

The commands switchport mode access or switchport mode trunk statically configure an interface in access or trunk mode respectively.

Instead of static trunk or access mode configuration, Cisco's Dynamic Trunking Protocol (DTP) allows Layer 2 interfaces to automatically negotiate either trunk or access mode operation.

In order to dynamically choose a trunking operational mode, an interface must be configured in dynamic mode.

There are 2 dynamic modes available for the switchport mode command:

  • dynamic auto
  • dynamic desirable

In current versions of Cisco IOS software, the default mode for a Layer 2 interface is dynamic auto. (Earlier versions defaulted to dynamic desirable).

Nomencalature - administrative vs operational mode

When discussing trunking modes on Cisco devices it is important to distinguish between the following terms:

Trunking administrative mode

The trunking administrative mode is the mode in which the interface has been configured using the switchport mode command. The trunking administrative mode can have one of the following 4 values:

  • access
  • trunk
  • dynamic auto
  • dynamic desired

Trunking operational mode

The trunking operational mode is the mode in which the interface actually operates. This mode is dependant on the trunking administrative mode as well as the results of DTP negotiation (if any such negotiation takes place).

The trunking operational mode can have one of the following 2 values:

  • access
  • trunk

(An interface will operate in either access or trunk mode.)

DTP negotiation

DTP negotiation involves the exchange of DTP frames between 2 neighboring interfaces. When an interface is configured in dynamic mode (auto or desirable) it will initiate DTP negotiation in order to select its own trunking operational mode.

When an interface is statically configured in access or trunk mode, it will normally participate in the DTP process by responding to DTP frames if it receives any. The next few sections describe how an interface selects its trunking operational mode based on its own trunking administrative mode and the results of the DTP process.

Static trunk/access configuration

When an interface is statically configured in access mode, it will operate in non-trunking (access) mode. It may participate in DTP negotiation, and if it does so, it will attempt to convert the link to a non-trunk link. Even if the neighboring interface does not agree to operate in access mode, this interface will operate in access mode.

When an interface is statically configured in trunk mode, it will operate in trunking mode. It may participate in DTP negotiation, and if it does so, it will attempt to convert the link to a trunk link. Even if the neighboring interface does not agree to operate in trunk mode, this interface will operate in trunk mode.

Let's consider what happens when 2 interfaces on neighboring switches are connected together. Consider the cases where each interface has a static access or trunk mode configuration.

Case 1: Both interfaces configured in access mode

Switch 1 Switch 2
access
access access

When both interfaces are configured in access mode, the resulting link will operate in access mode.

Case 2: Both interfaces configured in trunk mode

Switch 1 Switch 2
trunk
trunk trunk

When both interfaces are configured in trunk mode, the resulting link will operate in trunk mode.

Case 3: One interface configured in access mode, the other interface configured in trunk mode

Switch 1 Switch 2
access/trunk?
gi0/1gi0/1
access trunk
vlan 10,20,30,40
int gi0/1
 switchport mode access
vlan 10,20,30,40
int gi0/1
 switchport mode trunk

Let's take a look at the case where one interface is configured in access mode, and the other interface in trunk mode. Consider the configuration on each switch. Each switch has 4 VLANs (10, 20, 30, 40) defined. (VLAN 1, the default VLAN, also exists on each switch.)

Gi0/1 on Switch 1 is configured in access mode. The default configuration places this interface in VLAN 1.

Gi0/1 on Switch 2 is configured in trunk mode. The default configuration allows all VLANs on this interface and sets the native VLAN to VLAN 1.

On Switch 1: VLAN 1 traffic will be forwarded out of interface gi0/1 untagged. VLAN 10, 20, 30 and 40 traffic will not be forwarded out of interface g0/1.

On Switch 2: VLAN 1 traffic will be forwarded out of interface gi0/1 untagged (this is the native VLAN for this interface). VLAN 10, 20, 30 and 40 traffic will be forwarded out of interface g0/1 as tagged frames.

Switch 1 will discard tagged traffic (i.e. traffic for VLANs 10, 20, 30 & 40) received on interface gi0/1. It will accept untagged frames and forward them internally out of interfaces assigned to VLAN 1.

The resulting operation of the link between the switches would be the same as when both interfaces are configured in access mode for VLAN 1.
(Note: This only holds true because gi0/1 on Switch 1 is assigned to VLAN 1, and gi0/1 on Switch 2 has VLAN 1 configured as the native VLAN.)

Switchport mode dynamic

When the switchport mode is configured to dynamic, the interface uses the Cisco proprietary Dynamic Trunking Protocol (DTP) to determine its trunking operational mode. There are 2 different modes trunking administrative modes.

Dynamic Desireable

In dynamic desirable mode, an interface will actively attempt to convert the link to a trunk link. It will become a trunk interface if the neighboring interface is configured in trunk mode, dynamic auto mode or dynamic desirable mode.

Dynamic Auto

In dynamic auto mode, an interface will agree to operate in trunk mode only if the neighboring interface explicitly wants to form a trunk link. It will become a trunk interface if the neighboring interface is configured in trunk mode or dynamic desirable mode.

Let's look at the different cases when 2 neighboring interfaces are configured in dynamic mode.

Case 1: Both interfaces configured in dynamic auto mode

Switch 1 Switch 2
access
dynamic auto dynamic auto

When both interfaces are configured in dynamic auto mode, the resulting link will operate in access mode. (Neither interface will actively attempt to convert the link to a trunk link.)

Case 2: Both interfaces configured in dynamic desirable mode

Switch 1 Switch 2
trunk
dynamic desirable dynamic desirable

When both interfaces are configured in dynamic desirable mode, the resulting link will operate in trunk mode. (Each interface will actively attempt to convert the link to a trunk link.)

Case 3: One interface configured in dynamic auto mode the other interface configured as dynamic desirable

Switch 1 Switch 2
trunk
dynamic auto dynamic desirable

When one interface is in dynamic desirable and the interface is in dynamic auto, the resulting link will operate in trunk mode. (The interface in dynamic desirable mode will actively attempt to convert the link to a trunk link. The interface in dynamic auto mode will agree to operate in trunk mode.)

One interface statically configured, the other interface in dynamic mode

Now let's look at the cases when one interface is statically set to trunk or access and the other interface is in dynamic mode. There are a total of 4 possible combinations. (When an interface is statically configured, it may still participate in the DTP negotiation process by responding to incoming DTP frames.)

One interface in dynamic auto mode, the other interface in access mode

Switch 1 Switch 2
access
dynamic auto access

The interface on Switch 1 is configured in dynamic auto mode - it will initiate the DTP negotation to select its operational mode. The neighboring interface is statically configured in access mode and will indicate its desire to remain in access mode. As a result, the dynamically configured interface (on Switch 1) will operate in access mode.

One interface in dynamic auto mode, the other interface in trunk mode

Switch 1 Switch 2
trunk
dynamic auto trunk

The interface on Switch 1 is configured in dynamic desirable mode - it will initiate the DTP negotation to select its operational mode. The neighboring interface is statically configured in trunk mode and will indicate its desire to remain in trunk mode. As a result, the dynamically configured interface (on Switch 1) will operate in trunk mode.

One interface in dynamic desirable mode, the other interface in access mode

Switch 1 Switch 2
access
dynamic desirable access

The interface on Switch 1 is configured in dynamic desirable mode - it will initiate the DTP negotation to select its operational mode. It will indicate its desire to operate in trunk mode. The neighboring interface is statically configured in access mode and will indicate its desire to remain in access mode. Since the interface on Switch 2 does not agree to operate in trunk mode, the dynamically configured interface (on Switch 1) will operate in access mode.

One interface in dynamic desirable mode, the other interface in trunk mode

Switch 1 Switch 2
trunk
dynamic desirable trunk

The interface on Switch 1 is configured in dynamic desirable mode - it will initiate the DTP negotation to select its operational mode. It will indicate its desire to operate in trunk mode. The neighboring interface is statically configured in trunk mode and will indicate its desire to remain in trunk mode. Since both interfaces want to operate in trunk mode, the dynamically configured interface (on Switch 1) will operate in trunk mode and a trunk link will be formed.

Switchport nonegotiate

We have mentioned in a couple of places that an interface that is statically configured in access or trunk mode may participate in the DTP negotiation process. Are there instances when a statically configured interface does not participate in the DTP process? The next post will cover this scenario and the use of the switchport nonegotiate command.


VLANs, Trunking, subinterfaces and Router-on-a-stick are covered extensively in Course 5 - VLANs & Trunks on this website.

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