1、交换机的一些端口与其生成树协议doc交换机的一些端口与其生成树协议一、思科的三个fast 1、Port Fast(1)本质:让access接口不参与生成树,不发不收BPDU,在接口启用之后直接变为转发状态;(2)作用:节省了生成树的收敛时间,提高了效率。(3)用处:接主机的接入层交换机接口(4)配置:方法一:全局启用,然后在非access接口改;方法二:在access接口配置:SW1(config-if)#spanning-tree portfast方法三:在基于IOS的CatLyst交换机上SW1(config-if)#switchport host将端口置为接入模式并启用Portfast特
2、性禁用channel.(5)好处:防止工作站引导时的DHCP超时,Novell登录问题,Apple-talk地址发现等问题2、Uplink Fast(1)本质:根端口的备份;(2)作用:从而节省了生成树收敛时间(3)实现:在根端口失效时立即变为根端口,而不用等待max-age超时再从blocking状态直到切换为转发状态,该过程在5s之内完成。同时,交换机代理主机发送伪多播帧以抑制TCN拓扑变更通告,进而便于上游交换机将MAC地址表从发生故障的链路立即移动到新的端口。(4)用处:VLAN数目较少的接入层交换机(5)配置:SW2(config)#spanning-tree uplinkfast全
3、局模式下配置。配置完之后该交换机的优先级会增加到49152,并且所有接口的cost值会加上3000,使得该交换机不能成为根桥,当然这只在默认优先级和默认端口开销的交换机上有效.3、Backbone Fast(1)本质:指定端口的备份。(2)实现:当非直连上行链路down掉之后,上游交换机会发送一个次级BPDU,本地交换机收到这个次级BPDU后,先检查有没有到达根桥的替代路径,如果没有则在Max-age过期后发送自己的BPDU开始新的STP选举,如果有则向替代路径发送一个RLQ根链路查询,如果返回的响应是原先的根桥,则说明原来的根桥还活着。这时将把接收到次级BPDU的端口立即变为监听状态。(3)
4、作用:用于非直连检测。能节省20秒的收敛时间,不用等待最大寿命超时。(4)用处:所有交换机上(5)条件:点到点链路。如是共享链路,收到次级BPDU会正常的进行STP的选举。(6)配置:SW2(config)#spanning-tree backbonefast二、RSTP 1、端口状态:(1)Discarding:学习BPDU。由于用到了提议和协定,这个时间通常会在1S内完成。这是RSTP之所以快的主要原因。(2)Leaning:学习MAC地址(3)Forwarding:转发用户数据2、端口角色:(1)根端口(2)指定端口(3)代替端口:相当于cisco的uplink fast,是根端口的备份
5、,在根端口失效后立即变为根端口(4)备份端口:是指定端口的备份口,一般和指定端口位于同一个交换机上(5)边缘端口:相当于cisco的port fast,接主机,不发送BPDU,也不发送拓扑变化通告TC,在接收到BPDU时变为普通RSTP端口3、选举步骤:先选根桥,再选根端口,接着选指定端口、代替端口、备份端口4、选举原则:交换机角色选举原则为先看优先级再看基MAC;端口角色选举原则为:开销-sender ID-port ID 5、报文格式:76543210其中:7代表top change;0代表top change的ack;6代表提议proposal;5和4两个bit位表示端口角色。00为未知
6、端口角色,01为代替口或者是备份口(区别在于是否在同一个交换机上),10代表根端口,11代表指定端口3代表端口为学习状态;2代表转发状态;1代表协定aggrement.6、快的因素:端口状态和端口角色的变化(1)端口状态的变化:其实现是靠提议和协定(2)边缘端口可直接过渡到转发状态(3)多了一个根端口的备份口(4)多了一个指定端口的备份口(5)拓扑变更时直接由第一跳交换机向外发送TC位置位的BPDU 7、提议和协定非边缘端口一旦被打开,将会从对方交换机收到一个prosal的提议,同时自己也向对方以送一个提议,接下来会有应答协定。根桥根口会在这一提一答之间完成竞选,时间通常会少于1秒。不同于80
7、2.1D总共35秒的生成树选举时间,少了漫长的被动的等待。这是RSTP之所以快的主要原因。8、拓扑变更(1)条件:非边缘端口、进入转发状态!(2)实现:第一步:检测到拓扑变更,交换机立即启动一个TC while计时器,清除非边缘端口的MAC地址,并在这个时间内向其他交换机发送一个TC位置位的BPDU;第二步:接收到TC位置位的BPDU,交换机立即清除其他所有接口的MAC地址,并同时启动一个TC while计时器,将TC位置位的BPDU向其他交换机扩散.(3)特点:一步完成,检测到拓扑变更立即扩散,不需要等待根桥的通知;根桥在未收到TC位置位的BPDU时还可转发数据。9、配置:Switch(co
8、nfig)#spanning-tree mode rapid-pvst三、PVST和PVST+(1)作用:能实现负载分担,充分利用设备资源(2)做法:一个VLAN一棵生成树(3)后者是前者的增强(4)不足:在VLAN数目极多的情况下将会有很大的资源占用(5)配置:思科交换机上默认为pvst+,Switch(config)#spanning-tree mode pvst四、多生树MST 1、优势:在有效实现负载分担的同时,又能减少资源的占用,适合多VLAN的场合;2、实现:多个VLAN对应一个生成树实例,将生成树实例的数目控制在一个合理的范围之内,与逻辑拓扑的个数一致;3、属性:区域名称(32个
9、字节)、配置版本号(2个字节)、1个包含4096个要素的表(映射用)。这三个属性一致表明属性同一区域;4、BPDU:包含VLAN到实例映射的摘要、配置版本号、区域名称;5、特点:可和802.1D、802.1s互操作。一个MST可被看作是一个普通的交换机,参与其他生成树的选举;6、配置:Switch(config)#spanning-tree mode mst设置STP模式为MST Switch(config)#spanning-tree mst configuration进入MST配置模式Switch(config-mst)#show current查看当前MST配置Switch(config
10、-mst)#name cisco MST域Switch(config-mst)#revision 1配置版本号,不会自动递增Switch(config-mst)#instance 1vlan 1-500实例与VLAN的映射Switch(config-mst)#show pending显示未提交的MST配置Switch(config-mst)#end保存配置Switch(config)#spanning-tree mst 1root primary将这个交换机作为实例1的主根Switch(config)#spanning-tree mst 2root secondery将这个交换机作为实例2的备
11、份根五、生成树的保护1、根防护(1)作用:保护根(2)原理:将端口强行置为指定端口,并在接收到更好的BPDU时将接口disbale掉(3)用处:根桥的所有接口,其他交换机的所有接入接口。在冗余链路上怎么启用?没法启用!(4)配置:Switch(config-if)#spanning-tree guard root 2、BPDU防护(1)本质:不接收BPDU(2)目的:控制生成树,减少不安全因素;(3)实现:将不该收到BPDU的端口在收到时disable掉,直到收不到时再打开;(4)位置:接入接口;(5)配置:方法一:SW1(config-if)#spanning-tree bpduguard
12、enable在接口配置方法二:SW1(config)#spanning-tree portfast bpduguard在全局模式下配置3、BPDU过滤(1)本质:不发送BPDU.优先级高于BPDU防护(2)原理:在接口下配置的话为不发送也不接收所有BPDU,全局配置的话为不发送BPDU,但在接收到BPDU时变为普通的STP端口(3)配置:Switch(config)#spanning-tree portfast bpdufilter default Switch(config)#spanning-tree bpdufilter 4、UDLD(1)本质:就是一个协议,自动协商也可以直到单向链路检
13、测的作用(2)作用:单向链路检测,防止环路(3)模式:标准与积极,区别在于前者只通知,后者还可以主动err-disable端口(4)配置:SW(config-if)#udld port aggressive六、EtherChannel 1、本质:将多条物理链路捆绑成一条逻辑链路2、作用:增加带宽,提供冗余(无论交换机、端口还是链路,都不可避免地会发生故障。为了保证网络的畅通和稳定,提高网络的可用性,各种形式的冗余链接就成为必要。)3、种类:二层EtherChannel和三层EtherChannel 4、条件:快速以太网或吉比特以太网,不支持10M端口的通道处理5、限定:8个端口(catlyst
14、交换机),不必连续,也不必位于同一个模块中双工和速率必须相同一个端口只能属于一个通道组所有通道接口都必须位于同一个VLAN或相同本地VLAN的trunk链路中trunk模式必须相同(推荐)相同的VLAN开销配置对于不同的厂产,其有不同的命令进行,以下为思科产品的端口聚合实验:S1(config)#int?Ethernet IEEE 802.3 FastEthernet FastEthernet IEEE 802.3 GigabitEthernet GigabitEthernet IEEE 802.3z Port-channel Ethernet Channel of interfaces Vl
15、an Catalyst Vlans range interface range command S1(config)#int port-channel?1-6 Port-channel interface number S1(config)#int port-channel 1S1(config-if)#int f0/13 S1(config-if)#channel-group 1mode on%LINK-5-CHANGED:Interface Port-channel 1,changed state to up%LINEPROTO-5-UPDOWN:Line protocol on Inte
16、rface Port-channel 1,changed state to up%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/13,changed state to down%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/13,changed state to up S1(config-if)#int f0/14 S1(config-if)#channel-group 1mode on%LINEPROTO-5-UPDOWN:Line protoc
17、ol on Interface FastEthernet0/14,changed state to down%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/14,changed state to up S1(config-if)#int port-channel 1S1(config-if)#switchport mode trunk%LINEPROTO-5-UPDOWN:Line protocol on Interface Port-channel 1,changed state to down%LINEPROTO-5
18、-UPDOWN:Line protocol on Interface Port-channel 1,changed state to up%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/13,changed state to dow n%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/13,changed state to up%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/1
19、4,changed state to down%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/14,changed state to up S1(config-if)#speed 100%Command not available for fiber interfaces.S1(config-if)#speed?10 Force 10 Mbps operation 100 Force 100 Mbps operation auto Enable AUTO speed configuration S1(config-if)
20、#speed 100?cr S1(config-if)#speed 100%Command not available for fiber interfaces.S1(config-if)#duplex?auto Enable AUTO duplex configuration full Force full duplex operation half Force half-duplex operation S1(config-if)#duplex full?cr S1(config-if)#duplex full%Command not available for fiber interfa
21、ces.S1(config-if)#end%SYS-5-CONFIG_I:Configured from console by console S1#show int?Ethernet IEEE 802.3 FastEthernet FastEthernet IEEE 802.3 GigabitEthernet GigabitEthernet IEEE 802.3z Vlan Catalyst Vlans etherchannel Show interface etherchannel information switchport Show interface switchport infor
22、mation trunk Show interface trunk information cr S1#show int etherchannel S1#show int etherchannel?cr S1#show int etherchannel FastEthernet0/13:Port state=1 Channel group=1 Mode=On Gcchange=-Port-channel=Po1 GC=-Pseudo port-channel=Po1 Port index=0 Load=0x0 Protocol=-Age of the port in the current s
23、tate:00d:00h:02m:09s FastEthernet0/14:Port state=1 Channel group=1 Mode=On Gcchange=-Port-channel=Po1 GC=-Pseudo port-channel=Po1 Port index=0 Load=0x0 Protocol=-Age of the port in the current state:00d:00h:02m:09s-Port-channel1:Port-channel1 Age of the Port-channel=00d:00h:04m:36s Logical slot/port
24、=2/1 Number of ports=2 GC=0x 00000000 HotStandBy port=null Port state=Protocol=3 Port Security=Disabled Ports in the Port-channel:Index Load Port EC state No of bits-+-+-+-+-0 00 Fa0/13 On 00 00 Fa0/14 On 0Time since last port bundled:00d:00h:02m:09s Fa0/14 S1#S1#S1#S1#conf tEnter configuration comm
25、ands,one per line.End with CNTL/Z.S1(config)#port-channel load-balance dst-mac S1(config)#exit%SYS-5-CONFIG_I:Configured from console by console S1#show etherchannel summary Flags:D-down P-in port-channel I-stand-alone s-suspended H-Hot-standby(LACP only)R-Layer3 S-Layer2 U-in use f-failed to alloca
26、te aggregator u-unsuitable for bundling w-waiting to be aggregated d-default port Number of channel-groups in use:1 Number of aggregators:1 Group Port-channel Protocol Ports-+-+-+-1 Po1(SU)PAgP Fa0/13(P)Fa0/14(P)S1#R2#conf tEnter configuration commands,one per line.End with CNTL/Z.R2(config)#enable
27、password wei R2(config)#?Configure commands:access-list Add an access list entry banner Define alogin banner boot Boot Commands cdp Global CDP configuration subcommands clock Configure time-of-day clock do To run exec commands in config mode enable Modify enable password parameters end Exit from con
28、figure mode exit Exit from configure mode hostname Set systems network name interface Select an interface to configure ip Global IP configuration subcommands line Configure aterminal line logging Modify message logging facilities mac-address-table Configure the MAC address table mls mls global comma
29、nds no Negate acommand or set its defaults port-channel EtherChannel configuration privilege Command privilege parameters service Modify use of network based services snmp-server Modify SNMP engine parameters R2(config)#port-channel?load-balance Load Balancing method R2(config)#int port-channel 1R2(
30、config-if)#int f0/13 R2(config-if)#channel-group 1mode on%LINK-5-CHANGED:Interface Port-channel 1,changed state to up%LINEPROTO-5-UPDOWN:Line protocol on Interface Port-channel 1,changed state to up%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/13,changed state to down%LINEPROTO-5-UPDO
31、WN:Line protocol on Interface FastEthernet0/13,changed state to up R2(config-if)#int f0/14 R2(config-if)#channel-group 1mode on%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/14,changed state to down%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/14,changed state to up R2(c
32、onfig-if)#int port-channel 1R2(config-if)#switchport mode trunk%LINEPROTO-5-UPDOWN:Line protocol on Interface Port-channel 1,changed state to down%LINEPROTO-5-UPDOWN:Line protocol on Interface Port-channel 1,changed state to up R2(config-if)#speed 100%Command not available for fiber interfaces.R2(config-if)#duple xfull%Co
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1