Why DTP exists
When two switches are cabled together, someone has to decide whether the link is a trunk. DTP lets the two ports work that out themselves. Each port has an administrative mode, they exchange DTP frames, and the pair either becomes a trunk or stays an access link. DTP is Cisco proprietary, so it only works between Cisco devices, and it only runs on directly connected ports.
The five modes
On small screens, swipe sideways or focus the diagram and use the arrow keys.
What two ports become
On small screens, swipe sideways or focus the diagram and use the arrow keys.
A trunk on one end and an access port on the other does not negotiate down. Frames are tagged on one side and not the other, so traffic is lost. DTP also needs the switches to agree on the VTP domain name if both have one set; with different domains negotiation does not complete.
Configuring and verifying
Commands are based on Cisco IOS documentation and have not been run on a lab device here.
interface GigabitEthernet0/1
switchport mode trunk
switchport nonegotiate
!
interface range FastEthernet0/1 - 24
switchport mode access
switchport nonegotiateThe safe pattern: set every port explicitly, and stop DTP on all of them. On some models you first need switchport trunk encapsulation dot1q before switchport mode trunk.
SW1#show interfaces GigabitEthernet0/1 switchport Name: Gi0/1 Switchport: Enabled Administrative Mode: dynamic desirable Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default)
show dtp interface gi0/1 shows the DTP state and the frames sent and received, and show interfaces trunk lists the ports that are actually trunking.
DTP and security
A port left in a dynamic mode will answer DTP from anything that speaks it. An attacker who connects a laptop or a rogue switch can send DTP frames, make the port a trunk, and then send and receive traffic for every VLAN on it. That is a switch spoofing attack, a form of VLAN hopping. The defence is simple: set every access port to switchport mode access, set real trunks to switchport mode trunk with switchport nonegotiate, and shut down unused ports in an unused VLAN.
DTP in short
- DTP is Cisco proprietary and negotiates a trunk between two directly connected ports.
- Trunk and desirable start a trunk; auto only agrees; access never trunks.
- Two dynamic auto ports stay access ports.
- Best practice: static modes plus
switchport nonegotiate.
Test yourself
Two switches both have their ports set to dynamic auto. What is the result?
Which pair of modes forms a trunk?
What does switchport nonegotiate do?
Which attack is made possible by leaving a port in a dynamic mode?
Which show command compares the configured and actual trunking state of one port?