天天看點

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>

繼續閱讀