2.二層常用技術-Portfast和BPDU Guard、BPDU Filter


PortFast (生成樹端口加速)

1.在交換機上使用portfast命令,可以防止出現由於STP的收斂時間太長,導致主機的DHCP請求超時,從而使主機不能接收到DHCP地址的問題。

  確保有一台服務器或其他設備連接到交換機上時,可以保證在禁用STP時不會產生交換環路。使用端口加速意味着,當STP正在收斂時,端口不會花費通常的50秒才進入轉發狀態。 慎用,易出現環路!  

  asw2960(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 bridging loops.

  Use with CAUTION

  %Portfast has been configured on GigabitEthernet0/1 but will only  have effect when the interface is in a non-trunking mode.

BPDU Guard

1.BPDU Guard(BPDU保護),簡單的講它的意義就是一個不該接收BPDU的端口,比如被啟動了portfast的端口,一旦收到BPDU報文,那么BPDU保護功能將會立即關閉該端口,並將端口狀態置為error-disabled狀態。

  BPDU Guard的配置分為全局型的配置和接口級的配置,注意這兩種配置將帶來一些不同的效果。 

2.全局配置BPDU Guard

  全局配置BPDU Guard將使用spanning-tree portfast bpduguard default全局配置命令。全局配置BPDU Guard功能是必須依附於portfast而存在的,因為一個被規划為portfast的端口默認情況下是不應該連二層接橋接類設備。

  一般用戶連接桌面機和服務器,那么這樣的端口是不應該接收BPDU報文的,如果在全局配置了BPDUGuard功能,當portfast端口一旦收到BPDU報文,那么該端口將被關閉並轉入error-disabled狀態。

3.在接口上的BPDU Guard配置

  在接口模式下配置BPDU Guard是通過spanning-tree bpduguard enable接口配置命令來完成,注意在接口模式下啟動BPDU Guard功能,不需要依賴portfast而存在。換言之,在接口模式下啟動BPDU Guard功能時,

  無論該接口是一個什么接口,是否是portfast接口這些都不重要,只要管理員認為該接口不應該接收BPDU報文,那么就可以在接口上配置BPDUGuard功能。

  一旦這個接口被啟動BPDUGuard功能后,它接收到BPDU報文,那么該端口將被關閉並轉入error-disabled狀態。

  注意:一旦某個端口被轉入error-disabled狀態,必須通過管理員手工重啟並恢復該接口!

4.交換機觸發BPDU Guard后的提示信息:

  %LINEPROTO-5-UPDOWN: Line protocol on InterfaceEthernet1/0, changed state to down

  %LINEPROTO-5-UPDOWN: Line protocol onInterface Ethernet1/0, changed state to up

  %SPANTREE-2-BLOCK_BPDUGUARD: ReceivedBPDU on port Et1/0 with BPDU Guard enabled. Disabling port.

  %PM-4-ERR_DISABLE: bpduguard errordetected on Et1/0, putting Et1/0 in err-disable state

  %LINEPROTO-5-UPDOWN: Line protocol onInterface Ethernet1/0, changed state to down

  %LINK-3-UPDOWN: Interface Ethernet1/0,changed state to down 

BPDU Filter

1.默認時啟用了PortFast的交換機端口仍將接收BPDU,這時可以使用BPDU Filter完全阻止BPDU出入那個端口。如果接收到了BPDU,BPDU Filter過濾將立即使端口關閉PortFast,並迫使端口重新成為STP拓撲的一部分。

  BPDU Guard會將端口置為錯誤的禁用狀態,而BPDU Filter將使端口保持打開,但不運行PortFast。

  配置BPDU Guard和BPDU Filter:

  S1(config-if-range)#spanning-tree bpduguard ?

  disable Disable BPDU guard for this interface

  enable Enable BPDU guard for this interface

  S1(config-if-range)#spanning-tree bpdufilter ?

  disable Disable BPDU filtering for this interface

  enable Enable BPDU filtering for this interface

  BPDU Guard和BPDU Filter完成的是同一件事情,只需使用其中一個或另一個命令。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM