交换机生成树协议STP的配置命令

时间:2022-09-05 23:43:34

》打开或关闭STP

Catalyst 3548(Csico IOS系统)

命令格式:spanning-treevlan <vlan>                   //启用STP

                     nospanning-tree vlan <vlan>             //关闭STP

                    Switch-PHY-3548(config)#spanning-tree vlan 3

                    Switch-PHY-3548(config)#no spanning-tree vlan 3

                    Switch-PHY-3548(config)#


Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:set spantree enable                       //启用STP

                    set spantree disable                       //关闭STP

                    Switch-PHY-6500>(enable)set spantree enable 3

                    VLAN 3 bridgespanning tree enabled

                    Switch-PHY-6500>(enable)

                    Switch-PHY-6500>(enable)set spantree disable 3

                    VLAN 3 bridgespanning tree disable

                    Switch-PHY-6500>(enable)

》配置根网桥和备份根网桥

Catalyst 3548(Csico IOS系统)

命令格式:spanning-treevlan <vlans> root primary     //设置主ROOTprimaryroot

    Switch-PHY-3548(config)#spanning-tree vlan 3 root primary

    Switch-PHY-3548(config)#

命令格式:spanning-treevlan <vlans> root secondary   //设置备份ROOTsecond root

    Switch-PHY-3548(config)#spanning-tree vlan 3 root secondary

    Switch-PHY-3548(config)#

 

Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:setspantree root <vlans>                 //设置主ROOT

                    Switch-PHY-6500>(enable)set spantree root 1,200-204

                    VLANS1,200-204 bridge priority set to 8189.

                    VLANS1,200-204 bridge max aging time set to 20.

                    VLANS1,200-204 bridge hello time set to 2.

                   VLANS1,200-204 bridge forward delay set to 15.

                   Switch isnow the root switch for active VLANS 1,200-204.

                    Switch-PHY-6500>(enable)

命令格式:setspantree root secondary <vlans>        //设置备份ROOT

                   Switch-PHY-6500>(enable)set spantree root secondary 1,200-204

                    VLANS1,200-204 bridge priority set to 8189.

                   VLANS1,200-204 bridge max aging time set to 20.

                   VLANS1,200-204 bridge hello time set to 2.

                    VLANS 1,200-204 bridge forward delay set to15.

                   Switch isnow the root switch for active VLANS 1,200-204.

                   Switch-PHY-6500>(enable)

》配置生成树优先级(取值范围是0-61440,增量是4096

Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:spanning-treevlan <vlans> priority <0-61440>            

                   Switch-PHY-3548(config)#spanning-treevlan 3 priority 8192

                    Switch-PHY-3548(config)#


Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:setspantree priority <priority>

                   Switch-PHY-6500>(enable)set spantree priority 8192

                   spantree bridgepriority set to 8192.

                   Switch-PHY-6500>(enable)

》配置BackboneFast生成树可选功能

Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:spanning-treebackbonefast                    //允许backbonefast功能

                   Switch-PHY-3548(config)#spanning-tree backbonefast      

                   Switch-PHY-3548(config)#

 

Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:setspantree backbonefast enable               //允许backbonefast功能

命令格式:setspantree backbonefast disable               //不允许backbonefast功能

                   Switch-PHY-6500>(enable)set spantree backbonefast enable

                   Switch-PHY-6500>(enable)

》配置UplinkFast生成树可选功能

Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:spanning-treeuplinkfast <cr>

                   spanning-tree uplinkfast max-update-rate <0-32000> <cr>

                    //注:max-update-rate的值是0-32000,单位是packet/s(每秒更新的包数)

                    Switch-PHY-3548(config)#spanning-tree uplinkfast 32000     

                   Switch-PHY-3548(config)#spanning-tree uplinkfast

                    Switch-PHY-3548(config)#

 

Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:setspantree uplinkfast enable <cr>

                   setspantree uplinkfast enable rate <station_update_rate> <cr>

                    //注:<station_update_rate>的缺省值是15packets/100ms,单位是packet/ms.

                   Switch-PHY-6500>(enable)set spantree uplinkfastenable

                   VLANs 1-1005bridge priorityset to 49152.

                   The port costand portvlancost of all ports set to above 3000.

                   Station update rate set to 15 packets/100ms,

                   Uplinkfast all-portocols field set to off.

                    Uplinkfastenable for bridge.

                   Switch-PHY-6500>(enable)

                   Switch-PHY-6500>(enable)set spantreeuplinkfast enable rate 40

                   VLANs 1-4096bridge priorityset to 49152.

                   The port costand portvlancost of all ports set to above 3000.

                   Station update rate set to 40 packets/100ms,

                   Uplinkfast all-portocols field set to off.

                   Uplinkfastenable for bridge.

                   Switch-PHY-6500>(enable)

》配置PortFast生成树可选功能

Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:spanning-treeportfast default   

                   Switch-PHY-3548(config)#spanning-tree portfast default      

                    Switch-PHY-3548(config)#

 

Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:setspantree portfast <mod/port> enable       //打开portfast

                    setspantree portfast <mod/port> disable       //关闭portfast

                   setspantree portfast <mod/port> default       //缺省启用portfast   

                   Switch-PHY-6500>(enable)set spantree portfast3/2 enable

                   Warning:Connecting Layer 2 devices to a fast start port can cause

                    temporaryspanning tree loops.Use with caution.

 

                   Spantree ports3/2fast start enabled

                   Switch-PHY-6500>(enable)set spantree portfast 4/1-24 enable

                   Warning:Connecting Layer 2 devices to a fast start port can cause

                    temporaryspanning tree loops.Use with caution.

    

                   Spantree ports3/2fast start enabled

                   Switch-PHY-6500>(enable)

》配置BPDUFilter生成树可选功能

Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:spanning-treeportfast bpdufilter default <cr>

                    Switch-PHY-3548(config)#spanning-tree portfast bpdufilter default    

                    Switch-PHY-3548(config)#

 

Catalyst 6500(Catalyst OS(CatOS)系统)

命令格式:setspantree portfast bpdu-filter enable<cr>     //所有端口启用bpdu-filter

                    setspantree portfast bpdu-filter disable<cr>              //关闭bpdu-filter

                   setspantree portfast bpdu-filter <mod/port> enable <cr>   //打开bpdu-filter

                   setspantree portfast bpdu-filter <mod/port> disable <cr>   // 关闭bpdu-filter

                   setspantree portfast bpdu-filter <mod/port>default <cr>   //设置为缺省

    

                    Switch-PHY-6500>(enable)set spantree portfastbpdu-filter enable

                    Switch-PHY-6500>(enable)set spantree portfast bpdu-filter 3/1-24 enable

                    Warning:Portsenabled with bpdu filter will not send BPDUs and drop all received

                    BPDUs.You may cause loops in the bridge network if youmisuse this feature.           

                    Switch-PHY-6500>(enable)