实验45:trunk 配置<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1. 实验目的

通过本实验,读者可以掌握如下技能:

1) 配置交换机接口的trunk

2) 理解DTP 的协商规律

2. 实验拓扑

拓扑图

NA-NP-IE系列实验45:trunk 配置

3. 实验步骤

注:

1Trunk 链路上,数据帧会根据ISL 或者802.1Q 被重新封装,然

而如果是Native VLAN 的数据,是不会被重新封装就在Trunk 链路上传输。很显然链路两端

Native VLAN 是要一样的。如果不一样,交换机会提示出错

2DTP 配置有关的有以下命令,这些命令不能任意组合:

switchport trunk encapsulation negotiate | isl | dot1q }”:配置Trunk 链路

上的封装类型,可以是双方协商确定,也可以是指定的isl 或者dot1q

switchport nonegotiate” :Trunk 链路上不发送协商包,默认是发送的

switch mode { trunk | dynamic desirable | dynamic auto }”:

???? trunk:这个设置将端口置为永久trunk 模式,封装类型由“switchport trunk

encapsulation”命令决定

???? dynamic desirable:端口主动变为trunk,如果另一端为negotiatedynamic

desirable dynamic auto 将成功协商

???? dynamic auto:被动协商,如果另一端为negotiatedynamic desirable 将成功

协商。

 

sw1(config)#int f0/2
sw1(config-if)#switchport trunk enca dot1q
//以上是配置trunk 链路的封装类型,同一链路的两端封装要相同。有的交换机,例如2950

只能封装dot1q,因此无需执行该命令。

 

sw1(config-if)#switch mode trunk//以上是把接口配置为trunk

 

sw1(config-if)#
*Mar  1 00:01:37.055: %DTP-5-TRUNKPORTON: Port Fa0/2 has become dot1q trunk
sw1(config-if)#^Z
sw1#v
*Mar  1 00:10:24.423: %SYS-5-CONFIG_I: Configured from console by console
sw1#vlan data
sw1(vlan)#vlan 2 name ke
VLAN 2 added:
    Name: ke
sw1(vlan)#exit
APPLY completed.
Exiting....
sw1#vlan data
sw1(vlan)#vlan 3 name haojian
VLAN 3 added:
    Name: haojian
sw1(vlan)#exit
APPLY completed.
Exiting....
sw1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
sw1(config)#int f0/2
sw1(config-if)#do sh int f0/2 trunk       

 

Port      Mode         Encapsulation  Status        Native vlan
Fa0/2     on           802.1q         trunking      1

 

Port      Vlans allowed on trunk
Fa0/2     1-1005

 

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

 

Port      Vlans in spanning tree forwarding state and not pruned
Fa0/2     1-3
检查trunk 链路的状态,测试跨交换机、同一VLAN 主机间的通信

使用“show interface f0/13 trunk”可以查看交换机端口的trunk 状态

f0/2 接口已经为trunk 链路了,封装为802.1q

 

sw1(config-if)#switchport trunk native vlan 2
sw1(config-if)#do sh int f0/2 trunk         

 

Port      Mode         Encapsulation  Status        Native vlan
Fa0/2     on           802.1q         trunking      2

 

Port      Vlans allowed on trunk
Fa0/2     1-1005

 

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

 

Port      Vlans in spanning tree forwarding state and not pruned
Fa0/2     1-3
sw1(config-if)#exit
sw1(config)#exit
sw1#
*Mar  1 00:17:39.743: %SYS-5-CONFIG_I: Configured from console by console
sw1#vlan data
sw1(vlan)#vlan 2 name ke
VLAN 2 modified:
    Name: ke
sw1(vlan)#exit
APPLY completed.
Exiting....
sw1#vlan da
sw1(vlan)#vlan 3 name haojian
VLAN 3 modified:
    Name: haojian
sw1(vlan)#exit
APPLY completed.
Exiting....
sw1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
sw1(config)#int f0/0
sw1(config-if)#swit mo acc
sw1(config-if)#swi acc vlan 2
sw1(config-if)#exit
sw1(config)#int f0/1
sw1(config-if)#swi m acc
sw1(config-if)#swi acc vlan 3
sw1(config-if)#exit
sw1(config)#

 

 

 

 

 

 

sw2(config)#int f0/2
sw2(config-if)#switchport trunk enca dot1q
sw2(config-if)#switch mode trunk
sw2(config-if)#
*Mar  1 00:02:30.071: %DTP-5-TRUNKPORTON: Port Fa0/2 has become dot1q trunk
sw2(config-if)#^Z                        
sw2#v
*Mar  1 00:09:37.703: %SYS-5-CONFIG_I: Configured from console by console
sw2#vlan data
sw2(vlan)#vlan 2 name ke
VLAN 2 added:
    Name: ke
sw2(vlan)#exit
APPLY completed.
Exiting....
sw2#vlan dat
sw2(vlan)#vlan 3 name haojian
VLAN 3 added:
    Name: haojian
sw2(vlan)#exit
APPLY completed.
Exiting....
sw2#
*Mar  1 00:12:26.787: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with inconsistent peer vlan id 2 on FastEthernet0/2 VLAN1.
*Mar  1 00:12:26.787: %SPANTREE-2-BLOCK_PVID_PEER: Blocking FastEthernet0/2 on VLAN2. Inconsistent peer vlan.PVST+: restarted the forward delay timer for FastEthernet0/2

 

sw2#
*Mar  1 00:12:26.831: %SPANTREE-2-BLOCK_PVID_LOCAL: Blocking FastEthernet0/2 on VLAN1. Inconsistent local vlan.
sw2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
sw2(config)#int f0/2
sw2(config-if)#switchport trunk native vlan 2
sw2(config-if)#PVST+: restarted the forward delay timer for FastEthernet0/2

 

*Mar  1 00:13:14.783: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet0/2 on VLAN1. Port consistency restored.
sw2(config-if)# PVST+:Inconsistency timer expired. inconsistency 0
                 cleared for FastEthernet0/2

 

sw2(config-if)#
*Mar  1 00:13:29.783: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet0/2 on VLAN2. Port consistency restored.
sw2(config-if)# PVST+:Inconsistency timer expired. inconsistency 0
                 cleared for FastEthernet0/2

 

sw2(config-if)#do ping 192.168.64.2
% Unrecognized host or address, or protocol not running.

 

sw2(config-if)#exit
sw2(config)#int f0/0
sw2(config-if)#switch mode access
sw2(config-if)#switch access vlan 2
sw2(config-if)#exit
sw2(config)#int f0/1
sw2(config-if)#switch mode access 
sw2(config-if)#switch access vlan 2

 

转载于:https://blog.51cto.com/gauyanm/242915

相关文章:

  • 2021-08-05
  • 2021-12-31
  • 2021-11-15
  • 2022-01-17
  • 2021-07-28
  • 2021-06-17
  • 2021-12-07
  • 2021-12-02
猜你喜欢
  • 2021-06-06
  • 2021-10-21
  • 2022-01-16
  • 2021-06-30
  • 2021-05-30
  • 2021-12-30
  • 2021-05-19
相关资源
相似解决方案