四、        stp 的高级 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1)          portfast :在连接 pc 的端口上设置,减少 stp 的收敛时间

2)         

3)          uplinkfast : 上行链路快速 在有冗余链路的交换机上设置

4)          BackboneFast  主干快速,用于保护根桥

 
1、Backbone Fast 用于所有的SW
2、加速收敛(30S
3、当L1 Down时,B会发送一个劣等BPDU,告诉C,它就是Root
4、C经过和A沟通(使用Root Link Query BPDU查询),A告诉C自己还存在。
5、然后C告诉BA还活着,它还是Root
5)          快速 stp

RSTPRapid STP802.1W)快速STPRSTP是由IEEE,基于802.1D,开发的
 Alternate Port:在同一网段中,比指定端口成本稍高的端口,使用Keep-Alive来维
       持非根桥之间是否活动。
Backup  PortSWB收到自己指定端口的BPDU(环路),将其称为Backup Port
TOP发生改变时,洪泛快速(传统STPTSW再到R)。而RSTP直接洪泛。
6)          pvst mst

1.PVSTVLAN生成树

  Cisco专用的实施方法,需要ISL封装以进行工作。
2.CST公共生成树

  IEEE802.1Q对于VLAN和生成树的解决方案

3. 启用MST后,PVST+停止,SW变为RSTP操作,SW不同时使用MSTPVST+

  PVST:需要用ISL封装,可以实现第2层的负载均衡,每个VLAN一棵STP
  PVST+:支持在相同网络中同时存在CST(公共生成树)PVSTPVST+
 以用802.1Q封装。PVST+Catalyst 802.1Q trunks上是自动启动的。也是
 每个Vlan一棵STP。也可以实现第2层的负载均衡。
7)          BPDU Guard

BPDU Guard

1.在Postfast的端口上用,当交换机配了后,Portfast端口上一旦受到别的交换机的BPDU,立刻Shutdown(防止接口连入交换机)
2.手工重启
BPDU Filitering

1.BPDU Guard 的功能一样, Portfast端口上一旦受到别的交换机的BPDU,不会shutdown,只是暂时关闭一段时间,一旦连入的交换机撤去,就恢复了转发.  

2.自动恢复

8)          BPDU Skewing

BPDU Skewing

没在规定时间内收到BPDU时,会报错,这样会占用大量资源,使用Skewing可以控制不产生或少产生这些报错 Bpdu 的偏移:也就是bpdu到达目的端口的应到时间和实到时间的时间差

9)           ROOT Guard

DP端口上做,该端口就不会改变了,只会是DP了,这样可以防止新加入的交换机成为root,该端口就变成了永久的DP了,若新加入的交换机想成为root,则它的端口不能工作
10)     单向链路检测

Unidirectional Link Detection

检验线路是否能进行双向通信,用于通信不能正常进行时,会把端口中断直到链路恢复正常了为止
要求在所有的链路上都激活
单向连接检测 (UDLD)

1. 用于检测光纤或铜缆以太网链路上的故障:
2. 监视物理电缆的配置,并将通过"ErrDisabled“
状态将配置不正确的端口给down掉。 3. 避免出现单向连接,当检测到一个因为介或端口故障导致的单向连接时,将端口shutdown并标识为“ErrDisabled”状态,同时产生一个syslog信息
五、       命令

在特定的VLAN上运行STP

Switch#show spanning-tree vlan vlan-id
Switch(config)#spanning-tree vlan 200

 

设置优先级

Switch(config)#spanning-tree vlan 200 priority 4096

设置端口开销所有的stp

Switch(config-if)#spanning-tree cost 18

 

设置特定vlan的端口开销

Switch(config-if)#spanning-tree vlan 200 cost 17

 

参看所有vlan的根桥信息

Switch#show spanning-tree bridge

 

打开portfast

Switch(config-if)#spanning-tree portfast

Switch#show running-config interface {{fastethernet| gigabitethernet} slot/port}|{port-channel pc_number}

 

打开uplinkfast

Switch(config)#spanning-tree uplinkfast [max-update-rate max_update_rate]
Switch# show spanning-tree uplinkfast

 

打开backbonefast

Switch(config)#spanning-tree backbonefast
Switch#show spanning-tree backbonefast

 

启用mst(多个vlan一个stp

Switch(config)#spanning-tree mode mst
Switch(config)#spanning-tree mst configuration
Switch(config-mst)#name name

Switch(config-mst)#instance inst vlan range 加入vlan

Switch(config-mst)#instance 2 vlan 10-16,20

查看mst信息

Switch#show spanning-tree mst configuration
Switch#show spanning-tree mst X

 

打开bpdugard

Switch(config)#spanning-tree portfast bpduguard

Switch#show spanning-tree summary totals

 

打开bpdufilter

Switch(config)#spanning-tree portfast bpdufilter default
Switch(config-if)#spanning-tree guard root

Switch#show running-config interface interface x/y
Switch#show spanning-tree inconsistentports

 

单链路检测配置命令

Config#udld enable 激活光接口的单向链路检测,不能激活rj45的链路状态,发生黑洞时自动shutdown掉。
Config-if#udld enable
激活以太网接口的单向检测
Config-if#no udld enable
关闭以太网的单向检测状态
Config-if#udld disable
关闭光接口的单向检测
Config#udld reset
把接口复位,把关掉的单向检测复位
Config# show udld intreface
查看单向检测口的信息  
六、       端口聚合

1. Switch(config)#interface port-channel port-channel-number

Switch(config-if)#ip address address mask

把聚合的端口当成一个物理接口

2. 聚合的配置命令

Switch(config)#interface interface slot/port 进入将要聚合的端口
Switch(config-if)#channel-group number mode {auto | desirable | on} 聚合

active     Enable LACP unconditionally
auto       Enable PAgP only if a PAgP device is detected
desirable  Enable PAgP unconditionally
on         Enable Etherchannel only
passive    Enable LACP only if a LACP device is detected

3.查看命令

Switch#show running-config interface port-channel num

Switch#show running-config interface interface x/y

Switch#show etherchannel num port-channel

Switch(config-if)#channel-protocol {lacp | pagp}配置采用的协议

Switch(config)#port-channel load-balance type 配置负载平衡

4.协议

Pagp:思科私有封装协议

LACP;IEEE 802.1ad

七、       三层交换中的 vlan 路由

1. 类型一:打开三层端口即可 ip routing

2. 在同一VLAN中做二层转发,在不同VLAN间做三层转发

3.单臂路由

4.三层交换链接pc,直接在vlan中配置地址做vlan的路由

配置如下

Switch(config)#ip routing

Switch(config)#router ip_routing_protocol <options>

Switch(config)#interface vlan-id

Switch(config-if)#ip address n.n.n.n subnet-mask