实例:
1.拓扑图
2.使用的是三层交换机的镜像
3.注意事项:
cisco 默认开启生成树协议
H3C 默认关闭
4.具体操作:
由于镜像是三层交换机的,所以要在每台交换机上执行
SW1(config)#no ip routing //关闭路由功能
SW3(config)#line console 0
SW3(config-line)#logging synchronous //日志同步
SW3(config-line)#no exec-timeout 0 0 //取消会话超时
SW1#show spanning-tree
VLAN1 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address cc02.1aa8.0000
SW2#show spanning-tree
VLAN1 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address cc04.1aa8.0000
SW3#show spanning-tree
VLAN1 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address cc05.1aa8.0000
Configured hello time 2, max age 20, forward delay 15
SW1#show spanning-tree brief
VLAN1
Spanning tree enabled protocol ieee
Root ID Priority 32768
Address 000f.e21a.d4b1
Cost 38
Port 1 (FastEthernet0/0)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32768
Address cc02.1aa8.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/0 128.1 128 19 FWD 19 32768 cc04.1aa8.0000 128.1
FastEthernet0/1 128.2 128 19 FWD 38 32768 cc02.1aa8.0000 128.2
000f.e21a.d4b1 这个MAC地址不是我们搭建的交换机,而是受其他交换机的影响,所以,我们必须手动设置root id
SW1(config)#spanning-tree vlan 1 root primary //手动设置根
VLAN 1 bridge priority set to 8192
VLAN 1 bridge max aging time unchanged at 20
VLAN 1 bridge hello time unchanged at 2
VLAN 1 bridge forward delay unchanged at 15
SW1(config)#int f0/0
SW1(config-if)#shut
把SW1的f0/0再no shutdown 还可以恢复,中间也有间断(状态转换)
Blocking Listening learning forwarding
SW2(config)#int f0/1
SW2(config-if)#spanning-tree ?
cost Change an interface's spanning tree path cost
port-priority Change an interface's spanning tree priority
portfast Enable an interface to move directly to forwarding on link up
vlan VLAN Switch Spanning Tree
SW2(config-if)#spanning-tree portfast //连接主机的设为速端口
%Warning: portfast should only be enabled on ports connected to a single host.
Connecting hubs, concentrators, switches, bridges, etc.to this interface
when portfast is enabled, can cause temporary spanning tree loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/1 but will only
have effect when the interface is in a non-trunking mode
SW2(config-if)#int f0/1
SW2(config-if)#shut
SW2(config)#int f0/1
SW2(config-if)#no shut
(跳过监听,学习 直接FWD 状态)即能直接通信了!
SW3(config)#spanning-tree uplinkfast
SW3(config)#
*Mar 1 01:19:31.555: %SPANTREE_FAST-7-PORT_FWD_UPLINK: VLAN1 FastEthernet0/2 moved to Forwarding (UplinkFast).
SW3(config)#int f0/1
SW3(config-if)#shut
Interface Designated
Name Port ID Prio Cost Sts Cost Bridge ID Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/2 128.3 128 3019 FWD 19 32768 cc04.1aa8.0000 128.3
FastEthernet0/3 128.4 128 3019 FWD 3038 49152 cc05.1aa8.0000 128.4
状态直接转换!
发现没有丢包!