Dynamic Trunking Protocol (DTP)
Tags: cisco, ccna, computernetworking, systemadministrator
Published: 2023-07-08 19:08:10

DTP, Dynamic Trunking Protocol, is a Cisco proprietary protocol, therefore, other vendors do not support it. DTP simplifies the configuration of VLANs on a network because it allows switches to automatically negotiate the formation of a trunk without requiring manual configuration. However, it is considered best practice to disable DTP and use manual configuration.

Many Cisco switches, such as Catalyst 2960 and Catalyst 3650 Series, have DTP enabled by default, with their interfaces on dynamic auto mode. Though, it is important to highlight that as DTP is supported only by Cisco, we need to turn it off when connected to interfaces of other vendors' devices to avoid misconfiguration and problems on the network.

If we want to enable trunking with a device that doesn't support DTP, we can run the following commands to have a trunking interface that doesn't generate DTP frames:

`S1(config-if)# switchport mode trunk
S1(config-if)# switchport nonegotiate
`

## Interface Modes

There are 4 options when configuring a switch interface:

1. **Access:** the interface is put into permanent non-trunking mode. The neighboring interface will not affect its mode. It will always be non-trunking.
2. **Dynamic auto:** the interface is able to become a trunk link. The interface will convert to a trunk link if the neighboring interface is on the trunk or desirable mode. However, if both interfaces are on dynamic auto, the trunk is not able to be created. In summary, auto doesn't initiate but will form trunking if the other side initiates.
3. **Dynamic desirable:** the interface will actively attempt to convert the link into a trunk one. Also, it will be a trunk if the neighboring interface is set to trunk, desirable or auto.
4. **Trunk:** the interface is permanently in trunking mode and negotiates to convert the neighboring interface into a trunk link. In fact, the neighboring interface doesn't affect its trunk mode.

In order to visualize this negotiation, check the picture below:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yg3mc7u7zq8ants8eiom.png)
Source: https://networkjutsu.com/dynamic-trunking-protocol/

- If 2 switches are configured for dynamic desirable, a trunk will be formed between the 2 switches.
- If one side is set up with dynamic desirable and the other with dynamic auto, trunking will be formed.
- If both sides are in dynamic auto neither side initiates the trunking, so the port becomes an access port. Nevertheless, it is better practice to configure manually both sides for trunking or as access ports.
- If one port is configured as access and the other as a trunk, issues must arise. Therefore, both must be configured either as an access or as a trunk or use DTP. Yet the recommendation is to turn off DTP and manually configure both sides.

The commands used to configure a switch into the aforementioned modes are:
`Switch(config)# switchport mode access
Switch(config)# switchport mode dynamic auto
Switch(config)# switchport mode dynamic desirable
Switch(config)# switchport mode trunk`

In case we need an interface to stop generating DTP frames/DTP negotiation, we can run the <nonegotiate> command. **This command is only used with access and trunk ports.** On the other side, we must configure the neighboring interface manually as a trunk interface to establish a trunk link.
`S1(config-if)# switchport nonegotiate`

 
## Useful Commands

1- **To check the DTP settings** of a specific interface we can run the command below. In the example, we would like to verify interface g0/0.

`S1#show dtp interface g0/0`

Output:
S1# show dtp interface g0/0
DTP information for GigabitEthernet0/0:
TOS/TAS/TNS: ACCESS/AUTO/ACCESS
TOT/TAT/TNT: NATIVE/NEGOTIATE/NATIVE
Neighbor address 1: C80084AEF101
Neighbor address 2: 000000000000
Hello timer expiration (sec/state): 11/RUNNING
Access timer expiration (sec/state): never/STOPPED
Negotiation timer expiration (sec/state): never/STOPPED
Multidrop timer expiration (sec/state): never/STOPPED
FSM state: S2:ACCESS
times multi & trunk 0
Enabled: yes
In STP: no

2- **For more details about an interface**:

`S1#show interface g0/1 switchport`

Output:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0j8m1bq87gghyy7mgy90.png)


- **Administrative Mode** indicates what is actually configured on that particular port.
- **Operational Mode** is the actual status and the way the port behaves in response to the configuration and negotiation (if any) with the other side of the link.

3- **To show what interfaces are on trunking mode**, both commands run the same result:

`S1#show interfaces trunk 
S1#show int trunk`

Output:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrvxgkl7vm3kn590r3t8.png)


Thank you for reading!