zoukankan      html  css  js  c++  java
  • 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完成的是同一件事情,只需使用其中一个或另一个命令。

  • 相关阅读:
    static&初始化顺序
    java基础语法
    MySQL调优
    Nnginx调优
    cisco 一些基本命令
    路由器密码忘记
    利用GetPrivateProfileString读取配置文件(.ini)
    MFC中OnActivate函数解析
    在MFC应用程序中传输的消息类型
    MFC中UpdateData函数解析
  • 原文地址:https://www.cnblogs.com/xinghen1216/p/14025901.html
Copyright © 2011-2022 走看看