DTP and VTP (Cisco Proprietary Protocols)
Dynamic Trunking Protocol (DTP)
- Concept: A Cisco proprietary Layer 2 protocol that allows Cisco switches to dynamically negotiate the status of their switchports (access or trunk) without manual configuration.
- Details:
- Enabled by default on all Cisco switch interfaces.
- Security Risk: DTP should be manually disabled on all switchports in production networks to prevent attackers from exploiting it to form unauthorized trunks.
- Default Modes:
- Newer switches: Default to
dynamic auto. - Older switches: Default to
dynamic desirable.
- Newer switches: Default to
- Encapsulation Negotiation: Switches supporting both ISL (Inter-Switch Link) and dot1q (IEEE 802.1Q) use DTP to negotiate encapsulation. Default mode is
negotiate. ISL is favored over dot1q if both are supported. - DTP Frame Location: Sent in VLAN 1 when using ISL, or in the Native VLAN when using dot1q.
! Check interface switchport details (Administrative vs Operational mode)
Switch# show interfaces [interface_id] switchport
! Configure DTP modes
Switch(config-if)# switchport mode dynamic desirable
Switch(config-if)# switchport mode dynamic auto
! Disable DTP negotiation (Stops sending DTP frames)
Switch(config-if)# switchport nonegotiate
! Configure trunk encapsulation manually (Required on switches supporting both ISL and dot1q)
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# switchport trunk encapsulation isl
Switch(config-if)# switchport trunk encapsulation negotiate
Things to note:
show interfaces switchportdisplays both Administrative Mode (what you configured) and Operational Mode (what the port is actually doing after negotiation).- Manually configuring
switchport mode accessautomatically disables DTP negotiation. - Manually configuring
switchport mode trunkdoes NOT disable DTP; you must explicitly useswitchport nonegotiate. - DTP will not form a trunk with a router, PC, or server. You must manually configure the interface as a trunk for scenarios like Router-on-a-Stick.
DTP Operational Mode Matrix
When two Cisco switches connect, their administrative DTP modes determine the final operational state.
| SW1 \ SW2 | Access | Dynamic Auto | Dynamic Desirable | Trunk |
|---|---|---|---|---|
| Access | Access | Access | Access | Misconfig |
| Dynamic Auto | Access | Access | Trunk | Trunk |
| Dynamic Desirable | Access | Trunk | Trunk | Trunk |
| Trunk | Misconfig | Trunk | Trunk | Trunk |
Things to note:
- Misconfig: Connecting a manually configured Trunk to a manually configured Access port forces a mismatch. Traffic will not pass, and it will result in errors.
- Dynamic Desirable: Actively tries to form a trunk. Forms a trunk with everything except Access.
- Dynamic Auto: Passively waits. Forms a trunk only if the other side is Trunk or Desirable. Auto + Auto = Access.
graph TD
A[Interface Connected] --> B{Is other side Trunk or Desirable?}
B -- Yes --> C[Form Trunk]
B -- No --> D{Is this side Desirable?}
D -- Yes --> E[Wait for response / Form Trunk if other side agrees]
D -- No --> F[Remain Access Port]
VLAN Trunking Protocol (VTP)
- Concept: A Cisco proprietary Layer 2 protocol that allows you to configure VLANs on a central switch (Server), which then advertises the VLAN database to other switches (Clients) so they can synchronize.
- Purpose: Designed for large networks to prevent having to configure VLANs on every single switch manually.
- Current Status: Rarely used in modern networks and not recommended due to the risk of accidental database overwrites. VTP only syncs the VLAN database; it does not automatically assign switch interfaces to those VLANs.
VTP Versions
| Version | Features & Details |
|---|---|
| VTP v1 | Default version. Supports standard VLANs (1-1005) only. |
| VTP v2 | Introduces support for Token Ring VLANs (obsolete technology). |
| VTP v3 | Supports Extended VLANs (1006-4094). VTP Clients in v3 can save the VLAN database to NVRAM. |
VTP Modes Comparison
| Feature | Server Mode | Client Mode | Transparent Mode |
|---|---|---|---|
| Default Mode? | Yes | No | No |
| Create/Modify/Delete VLANs? | Yes | No (Rejected) | Yes (Local only) |
| Save VLAN DB to NVRAM? | Yes | No (Yes in v3) | Yes |
| Sync to higher Revision #? | Yes | Yes | No |
| Advertise own VLAN DB? | Yes | Yes | No |
| Forward VTP Advertisements? | Yes | Yes | Yes (Only if domain matches) |
Things to note:
- VTP Servers act as Clients too: A Server will synchronize its VLAN database if it receives a VTP advertisement with a higher revision number.
- VTP Domain: By default, the domain name is
NULL. If a switch with a NULL domain receives a VTP advertisement containing a domain name, it will automatically join that VTP domain. - VTP Advertisements: Only sent and received over Trunk interfaces.
The Danger of VTP: Configuration Revision Number
- Concept: VTP uses a Configuration Revision Number to determine which VLAN database is the newest. The switch with the highest revision number wins, and all other switches in the domain will overwrite their VLAN databases to match it.
- The Threat: If you plug an old, unused switch into your network that has the same VTP domain name and a higher revision number than your current network, all switches will sync to the old switch. This will delete your current VLANs and cause a massive network outage.
Resetting the VTP Revision Number to 0
To safely add an old switch to a VTP network, you must reset its revision number to 0 first. There are two primary methods to do this:
- Change the VTP domain name to an unused domain name.
- Change the VTP mode to transparent.
! Show VTP status, domain, version, and revision number
Switch# show vtp status
! Configure VTP Domain name
Switch(config)# vtp domain [name]
! Configure VTP Mode
Switch(config)# vtp mode server
Switch(config)# vtp mode client
Switch(config)# vtp mode transparent
! Configure VTP Version (Changing version increases the revision number!)
Switch(config)# vtp version [1 | 2 | 3]
Things to note:
- Changing the VTP version (e.g., from v1 to v2) increases the revision number and triggers advertisements.
- Transparent mode switches maintain their own independent VLAN database in NVRAM. They do not sync, but they will pass through VTP advertisements to other switches, provided the VTP domain name on the transparent switch matches the advertisement.
Important Exam Concepts & Misconceptions
- VTP does not assign ports: VTP only propagates the VLAN database (VLAN IDs and names). You must still manually configure
switchport access vlan [id]on every individual switch. - DTP with non-Cisco devices: DTP is Cisco proprietary. It will not negotiate with non-Cisco switches.
- Static vs Dynamic Access:
show interfaces switchportmay show “Static Access”. This simply means an access port assigned to a single, unchanging VLAN. (Dynamic access ports assign VLANs based on MAC address via a server, which is out of CCNA scope). - Resetting Revision Number: Memorize the two ways to reset the VTP revision number to 0 (Change domain to unused name, or change mode to transparent).
Command Summary
! --- DTP COMMANDS ---
! View interface switchport details (Admin vs Operational mode)
Switch# show interfaces [interface_id] switchport
! Set DTP negotiation modes
Switch(config-if)# switchport mode dynamic desirable
Switch(config-if)# switchport mode dynamic auto
! Disable DTP frames (Stops negotiation)
Switch(config-if)# switchport nonegotiate
! Manually set trunk encapsulation (If switch supports both ISL and dot1q)
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# switchport trunk encapsulation isl
Switch(config-if)# switchport trunk encapsulation negotiate
! --- VTP COMMANDS ---
! View VTP status (Version, Domain, Mode, Revision Number)
Switch# show vtp status
! Set VTP Domain Name
Switch(config)# vtp domain [name]
! Set VTP Operating Mode
Switch(config)# vtp mode server
Switch(config)# vtp mode client
Switch(config)# vtp mode transparent
! Set VTP Version (1, 2, or 3)
Switch(config)# vtp version [1 | 2 | 3]