Cisco(config)#spanning-tree vlan 10 //激活特定vlan的STP
Cisco(config)#spanning-tree vlan 10 priority 0 //配置桥优先级,默认为32768,必须是4096的倍数
Cisco(config)#spanning-tree vlan 10 root primary //配置主根(生成树vlan优先级为24576)
Cisco(config)#spanning-tree vlan 10 root secondary //配置次根(生成树vlan优先级为28572)
Cisco(config-if)#spanning-tree vlan 10 cost 10 //设置接口vlan 10的生成树cost值
Cisco(config-if)#spanning-tree cost 10 //设置接口生成树cost值
Cisco(config-if)#spanning-tree vlan 10 port-priority 64 //设置接口vlan 10的生成树优先级
Cisco(config-if)#spanning-tree port-priority 64 //设置接口生成树优先级
Cisco#debug spanning-tree events
Cisco(config-if)#spanning-tree portfast edge //将特定接口激活portfast特性
Cisco(config-if)#spanning-tree portfast edge trunk //将特定trunk接口激活portfast特性(该接口不能直连交换机,连接支持trunk封装的路由器或服务器)
Cisco(config)#spanning-tree portfast edge default //将所有非trunk接口激活portfast特性(不触发TCN,可绕过listening和learning状态,加速收敛)
Cisco(config)#spanning-tree vlan 10 hello-time 2 //
设置STP的相关时间
Cisco(config)#spanning-tree vlan 10 forward-time 15
Cisco(config)#spanning-tree vlan 10 max-age 20
Cisco(config)#spanning-tree mode rapid-pvst //将生成树模式改为RSTP