配置 DTP动态中继协议

(Dynamic Trunking Protocol),思科技术。

 

  动态中继协议DTP,是 VLAN 组中思科的私有协议,主要用于协商两台设备间链路上的中继过程及中继封装 802.1Q 类型。DTP的用途是取代动态ISL(Dynamic ISL,DISL)。

 

  下列是DTP可以配置的几种不同的状态:

 

  * Access:使某个接口无条件进入Access模式,无DTP功能。

 

  * Trunk:使某个接口无条件进入trunk模式并进行trunk链路协商,无论其邻居接口处于何种模式。

 

  * Nonegotiate:指定DTP协商报文不允许在二层接口上发送。非协商状态,使接口成为永久的中继接口。由于接口不使用DTP信息帧进行通信,因此不会有协商发生。如果与非交换机设备相连的交换机接口存在DTP问题,那么在使用trunk之后可以使用nonegotiate,使得接口可以继续中继,但不会发送任何DTP信息。

 

  * Dynamic desirable:使某个接口既主动发送DTP报文,也允许对DTP报文进行响应,这是以太网接口的默认状态。如果邻居接口是中继接口,并且被设置为on,desirable或auto,那么希望desirable状态下的这个接口成为中继接口。

 

  * Dynamic auto:使某个接口可以响应DTP报文,但不允许主动发送DTP报文。只有在相邻接口要求该接口成为中继接口时才会成为中继接口。这是所有交换机接口的默认配置。auto接口不会主动要求对方,如果两个接口都被配置成auto状态,那么这两个接口都不会成为中继端。

 

  * On:无论对端配置如何,该接口始终为中继接口。使用on状态时,必须指明帧的标记方式,因为此状态下接口不与对端进行协商。

 

  * Off:该拉口永远是非中继接口。 第一个问题是,中继电缆(trunk cable)两端最好都能理解它们是中继端口,否则它们将中继帧视为正常帧。终端工作站无法理解信息帧头里另外添加的标签信息,其驱动程序栈也无法识别该标签信息,从而导致终端系统锁定或当机。为解决这个问题,思科推出了用于交换机的协议以实现通信目的。推出的第一版本是 VTP,即 VLAN 中继协议,它与 ISL 共同工作。最新推出的版本,即动态中继协议 (DTP),也可与 802.1q 共同工作。

 

  其次是创建 LAN 。一个交换机的配置 VLAN ,需要做很多工作并且容易引起较多矛盾,如在一台交换机上 VLAN 100 属于工程部,而在另一台交换机上 VLAN100 可能被配置成属于财务部。这就使在故障排除工作中引起混乱,也会破坏精心设计的 VLAN 安全模式。该问题可通过 VTP/DTP 解决。在某台交换机上创建或删除一个 VLAN ,该信息自动传播到相同管理控制区域下的所有交换机上,这些交换机就是一个 VTP 域。

配置实验拓扑:

Capture

预备知识:

      DTP (Dynamic Trunking Protocol), 用来动态协商端口类型为Access或者Trunk。要完成自动协商,2端口必须在同一个VTP domain中。每30s发送一次DTP的frame. 该协议仅在交换机间协商。

Capture1

实验要求:

      两台3560交换机用两条线相连,配置DTP协议,查看接口类型。

实验过程:

第一步:配置交换机3560-1与3560-2预配置

Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hos 3560-1
3560-1(config)#no ip domain-loo
3560-1(config)#line con 0
3560-1(config-line)#no exec-t
3560-1(config-line)#logg syn
3560-1(config-line)#end
3560-1#
%SYS-5-CONFIG_I: Configured from console by console
3560-1#sh ip int b
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/1        unassigned      YES manual up                    up
FastEthernet0/2        unassigned      YES manual up                    up
FastEthernet0/3        unassigned      YES manual down                  down
FastEthernet0/4        unassigned      YES manual down                  down
FastEthernet0/5        unassigned      YES manual down                  down
FastEthernet0/6        unassigned      YES manual down                  down

3560-1#sh spanning-tree
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000A.4119.3495
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     000A.4119.3495
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2            Desg FWD 19        128.2    P2p
Fa0/1            Desg FWD 19        128.1    P2p

Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hos 3560-2
3560-2(config)#no ip domain-loo
3560-2(config)#line con 0
3560-2(config-line)#no exec-t
3560-2(config-line)#logg syn
3560-2(config-line)#end
3560-2#
%SYS-5-CONFIG_I: Configured from console by console
3560-2#sh ip int b
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/1        unassigned      YES manual up                    up
FastEthernet0/2        unassigned      YES manual up                    up
FastEthernet0/3        unassigned      YES manual down                  down
FastEthernet0/4        unassigned      YES manual down                  down
FastEthernet0/5        unassigned      YES manual down                  down

 

3560-2#sh spanning-tree
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000A.4119.3495
             Cost        19
             Port        1(FastEthernet0/1)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     00D0.D396.CC29
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Root FWD 19        128.1    P2p
Fa0/2           Altn BLK 19        128.2    P2p     //由于生成树自动打开,fa0/2阻塞

第二步:配置DTP动态协议

3560-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
3560-1(config)#int fa 0/1
3560-1(config-if)#sw mode ?
  access   Set trunking mode to ACCESS unconditionally
  dynamic  Set trunking mode to dynamically negotiate access or trunk mode  
  trunk    Set trunking mode to TRUNK unconditionally
3560-1(config-if)#sw mode dy
3560-1(config-if)#sw mode dynamic ?
  auto       Set trunking mode dynamic negotiation parameter to AUTO
  desirable  Set trunking mode dynamic negotiation parameter to DESIRABLE
3560-1(config-if)#sw mode dynamic de
3560-1(config-if)#sw mode dynamic desirable

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
3560-1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
3560-1(config-if)#no sh
3560-1(config-if)#exi
3560-1(config)#int fa 0/2
3560-1(config-if)#sw mode dy
3560-1(config-if)#sw mode dynamic de
3560-1(config-if)#sw mode dynamic desirable

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
3560-1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
3560-1(config-if)#no sh
3560-1(config-if)#end        //3560-1 DTP协议配置完

3560-2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
3560-2(config)#int fa 0/1
3560-2(config-if)#sw mode dy de
3560-2(config-if)#sw mode dy desirable

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
3560-2(config-if)#
3560-2(config-if)#no sh
3560-2(config-if)#int fa 0/2
3560-2(config-if)#sw mode dy de

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
3560-2(config-if)#
3560-2(config-if)#no sh

第三步:DTP检验

3560-1#sh int sw
Name: Fa0/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)
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: All
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Protected: false
Unknown unicast blocked: disabled
Unknown multicast blocked: disabled
Appliance trust: none

Name: Fa0/2
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)
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: All
--More--

3560-1#sh int tru
Port        Mode         Encapsulation  Status        Native vlan
Fa0/1       auto         n-802.1q       trunking      1
Fa0/2       auto         n-802.1q       trunking      1
   //可以看出协商成功

Port        Vlans allowed on trunk
Fa0/1       1-1005
Fa0/2       1-1005

Port        Vlans allowed and active in management domain
Fa0/1       1
Fa0/2       1

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       1
Fa0/2       1