天天看点

STP生成树---安全链路备份!

实例:

1.拓扑图

<a href="http://5645432.blog.51cto.com/attachment/201208/12/5635432_13447788821ETQ.jpg"></a>

2.使用的是三层交换机的镜像

<a href="http://5645432.blog.51cto.com/attachment/201208/12/5635432_1344778886vEKk.png"></a>

<a href="http://5645432.blog.51cto.com/attachment/201208/12/5635432_1344778888OjFi.png"></a>

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

Bridge Identifier has priority 32768, address cc04.1aa8.0000

SW3#show spanning-tree

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

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

<a href="http://5645432.blog.51cto.com/attachment/201208/12/5635432_1344778891MJII.jpg"></a>

<a href="http://5645432.blog.51cto.com/attachment/201208/12/5635432_1344778894LY1e.jpg"></a>

<a href="http://5645432.blog.51cto.com/attachment/201208/12/5635432_13447788972TZt.jpg"></a>

<a href="http://5645432.blog.51cto.com/attachment/201208/12/5635432_1344778899KCQi.jpg"></a>

<a href="http://5645432.blog.51cto.com/attachment/201208/12/5635432_1344778901IJYE.jpg"></a>

SW1(config)#int f0/0

SW1(config-if)#shut

<a href="http://5645432.blog.51cto.com/attachment/201208/12/5635432_1344778904Z79d.jpg"></a>

把SW1的f0/0再no shutdown 还可以恢复,中间也有间断(状态转换)

Blocking Listening learning forwarding

<b>SW2(config)#int f0/1</b>

<b>SW2(config-if)#spanning-tree ?</b>

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

<b>vlan VLAN Switch Spanning Tree</b>

<b>SW2(config-if)#spanning-tree portfast //</b><b>连接主机的设为速端口</b>

<b>%Warning: portfast should only be enabled on ports connected to a single host.</b>

<b>Connecting hubs, concentrators, switches, bridges, etc.to this interface</b>

<b>when portfast is enabled, can cause temporary spanning tree loops.</b>

<b>Use with CAUTION</b>

<b>%Portfast has been configured on FastEthernet0/1 but will only</b>

<b>have effect when the interface is in a non-trunking mode</b>

<b>SW2(config-if)#int f0/1</b>

<b>SW2(config-if)#shut</b>

<b>SW2(config-if)#no shut</b>

<b>(跳过监听,学习 </b><b>直接FWD </b><b>状态)即能直接通信了!</b>

<b>SW3(config)#spanning-tree uplinkfast</b>

<b>SW3(config)#</b>

<b>*Mar 1 01:19:31.555: %SPANTREE_FAST-7-PORT_FWD_UPLINK: VLAN1 FastEthernet0/2 moved to Forwarding (UplinkFast).</b>

<b>SW3(config)#int f0/1</b>

<b>SW3(config-if)#shut</b>

<b>Interface Designated</b>

<b>Name Port ID Prio Cost Sts Cost Bridge ID Port ID</b>

<b>-------------------- ------- ---- ----- --- ----- -------------------- -------</b>

<b>FastEthernet0/2 128.3 128 3019 FWD 19 32768 cc04.1aa8.0000 128.3</b>

<b>FastEthernet0/3 128.4 128 3019 FWD 3038 49152 cc05.1aa8.0000 128.4</b>

<b>状态直接转换!</b>

<b>发现没有丢包!</b>

<b></b>

<b>本文转自 gjp0731 51CTO博客,原文链接:http://blog.51cto.com/guojiping/961622</b>

继续阅读