2.4-EN_STP

2.4EN_STP
    增强型生成树协议(EN_STP):
Spannig Tree port states:
blocking 20s+listening 15s+learning 15s最后才forwarding
这就是为什么交换机冗余切换会丢几个包的原因--但这些时间都是不一定的,可能blocking会经过很短时间就直接进入listening。    
    方法一:PortFast:
    PortFast只适用于交换机与主机(电脑)直连的端口;
不应该在交换机与交换机、路由器、Hub等互连的网络设备的端口使用→会导致短暂的STP环路(STP Loop)并立刻导致广播风暴!
    建立命令:(c)#int f0/1(交换机上直连主机的端口) →switchport mode access(接入链路) →spanning-tree portfast ;
    对于portfast端口,如果其接收到BPDU包,往往意味着本该连接主机的端口已经不正确的连接到了交换网络→这意味着很可能已经形成了STP环路(STP Loop)并导致了广播风暴→交换网络立刻会暂短的瘫痪→这是发生在STP算法判断出环路并将特定端口堵塞之前的!
    方法二:uplink-fast:
    在所有接入层交换机上配置uplink-fast,用于加快因为直链故障/直链检测错误(如果sw1与sw3之间链路段了,sw3可以直接检测到,这种情况就叫做直链检测错误)所导致的缓慢的STP网络收敛速度;direct link failure →uplink-fast应该在所有接入层/非核心层交换机上配置(根桥和备份根桥不要做),否则很可能会引起STP网络的环路;
    配置命令:(c)#spanning-tree uplinkfast →速度由35s变为0s(跳过了接口的listening/learning状态)。
    方法三:backbone-fast:
    在所有的交换机上配置backbone-fast,用以使全网的交换机在遇到非直链检测错误(如果sw1与sw2之间断,对于sw3来说是不能直接检测到的,这种情况就叫做:非直链检测错误)时快速收敛;indirect link failure ;
    配置命令:(c)#spanning-tree backbone →速度由50s变为35s 。
前面三种都是CISCO私有的,如果网络有别的品牌交换机则使用上会出问题。
IEEE 802.1D     Media Access Control (MAC) bridge
IEEE 802.1Q     Virtual Bridged Local Area Networks
IEEE 802.1W     Rapid STP(RSTP)(业界的开放新标准)
                RSTP provides faster convergence than "IEEE 802.1D" STP when topology changes occur.
                
    方法四:portfast bpduguard:
      交换机端口的portfast bpduguard,是指在交换机的某端口接收到BPDU包后立刻关闭端口,以避免了更大范围的广播风暴的措施;portfast bpduguard要在连接主机的端口上配置;
    基于接口的命令:(c-i)#spanning-tree bpduguard enable ;
    基于全局的命令:(c)#spanning-tree portfast bpduguard default ;
    是指在所有已经启动了portfast端口中,启动bpduguard 。
    方法五:portfast-bpdufilter:
    要在特定的portfast端口上配置,非PortFast接口无效;
    基于接口的命令:(c-i)#spanning-tree bpdufilter enable ;
    基于全局的命令:(c)#spanning-tree portfast bpdufilter default 。
  
    (以上的几种特性,都是cisco私有的)
   
    RSTP(802.1w Rapid STP ):
    RSTP是业界的开放性标准。
                RSTP provides faster convergence than "IEEE 802.1D" STP when topology changes occur.
    RSTP的4种端口角色:
    root port :(forwarding);
    designated port:(forwarding);
    alternate port:收到别的交换机转发来的BPDU,此端口是blocking
    backup port:收到本交换机转发来的BPDU,此端口是blocking
    RSTP的3种端口状态:
    discarding ;
    learning ;
    forwarding 。
    RSTP链路分类:
    全双工链路为:point to point 链路;
    半双工链路为:share link链路--不论是HUB连交换机或者PC连交换机都叫share link。
RSTP的两种端口类型:
Edge Port & Non-Edge Ports
Edge port :用于连接主机的端口:
Functions similarly to portfast,
(Immediately transitions to forwardin)
Unlike portfast,
an edge port that receives a BPDU,
immediately loses its edge port status and becomes a normal spanning tree port.
可以这么说:802.1w比CISCO(或802.1d)先进,当接受到BPDU的时候由portfast变成stp端口,可以进行blocking或者forwarding。
    启动RSTP的命令:
    SW(c)#spanning-tree mode pvst/rapid-pvst 。(per-vlan rapid spanning tree)
show sapnning-tree
show spanning-tree vlan 1
选举方式与STP生成树那节课是一样的。
    standard 802.1q是CST(单生成树):--CISCO是不会这么做的。
    缺点:所有的VLAN都是按照同一个STP来运行;
    所有的交换机都只维护一个STP实体(instance);
    所有VLAN的数据流量都压向一个根桥交换机--可能会压垮一个交换机;
    无法做基于VLAN的L2负载均衡;
    优点:对交换网络的开销较小→所有的VLAN都共享一个STP实体。
    Cisco私有的STP mode PVST (Per Vlan STP):
    优点:可以为每个VLAN配置一个STP;
    不同交换机可以是不同VLAN的根桥;
    可以实现基于VLAN的L2负载均衡;
    缺点:交换机维护很多的STP实体→对交换网络的开销比较大
    任意一个VLAN的拓扑变化都可能波及到很多交换机重新运算→收敛稍慢。
    MST(802.1s Multiple Spanning Tree):
    MST是业界开放性标准;就是对standard 802.1q/PVST的折衷方案→基于“组/instance”的STP;
(一个组可以对应多个结构相同的VLAN,大大节省交换机开销)
    MST的主要配置步骤:首先对VLAN进行分组(instance);每个组都可以有独立的STP、根桥,实现了L2负载均衡冗余,互为备份。
----------------------------------------------------------------------------
   LAB1:通过PVST实现VLAN间的冗余和L2负载均衡:
    STEP1:选定STP的运行模式:
    在交换机上(c)#spanning-tree mode pvst/rapid-pvst(两种都可以pvst为802.1d;rapid-pvst为802.1w) ;
    STEP2:通过配置VTP,使全网的交换机都有相应的VLAN:
    sw1/2/3(config)#vtp domain CCNP ;
    sw1/2/3(config)#vtp password 123
    sw3/2(config)#vtp mode server ;
    sw1/2/3(config)#vtp purning清除旧的vlan信息
    sw3(config)#vtp mode client ;
    然后在其中的一个VTP server上增加vlan 10和vlan20;
    STEP3:SW3和SW1分别成为VLAN10和VLAN20的根桥:
    sw3(config)#spanning-tree vlan 10-15 root primary ;
    sw1(config)#spanning-tree vlan 20-25 root primary ;
    同时两交换机要互为备份(互为对方的备份根):
    sw3(config)#spanning-tree vlan 20-25 root secondary ;
    sw1(config)#spanning-tree vlan 10-15 root secondary ;
    STEP4:在SW2上观察对于体定VLAN哪个是根端口:
    sw2#sh spanning-tree vlan 10 ;
    sw2#sh spanning-tree vlan 20 。
----------------------------------------------------------------------------
   LAB2:通过MST,实现L2的VLAN间的负载均衡:
    STEP1:选定交换机的stp模式为MST:
    sw1/2/3(c)#spanning-tree mode mst ;
    STEP2:将vlan划分到不同的“instance/组”中:--先要创建VLAN。
    sw1/2/3(c)#spanning-tree mst configuration ;
    sw1/2/3(c-mst)#instance 1 vlan 10-15 ;
    sw1/2/3(c-mst)#instance 2 vlan 20-25 ;
    以上步骤所有交换机都要做。
    STEP3:在核心交换机上为不同的组配置不同的优先级,实现两个组的互为备份/负载均衡:
    确定每个组的根桥:
    sw3(c)#spanning-tree mst 1 root primary ;
    sw1(c)#spanning-tree mst 2 root primary ;
    互为备份: 
    sw3(c)#spanning-tree mst 2 root secondary ;
    sw1(c)#spanning-tree mst 1 root secondary ;
    STEP4:
    sw1/2/3#sh spanning-tree mst configuration ;
      instance        vlans mapped
      0               1-9,16-19,26-4096(默认都在0号组)
      1               10-15
      2               20-25  ;
    STEP5:
    sw3#sh spanning-tree mst 1/2 。
EtherChannel:网络聚合--如:把两条100M的冗余线路捆绑成一条逻辑链路,既然使一条,那么STP就不起作用了。
Logical aggregation of similar links
Load balances
Viewed as one logical port
Redundancy
作用:
1:增大链路带宽
2:Redundancy
3: Load balances
example:
FEC(Fast Ether Channel)(100Mbps)
GEC(Giga Ether channel)(1000Mbps)
LAB:通过FEC,实现交换机之间,高带宽,冗余,负载均衡的链路
提醒:
所有参与channel-group的接口的配置参数,必须完全一致。
(譬如:速率,全双工模式等)
step1:先恢复接口的默认配置:
SW1/2(CONFIG)#interface range fa 0/11 -12
SW1/2(CONFIG)#speed 100
SW1/2(CONFIG)#duplex full
step2:
SW1/2(CONFIG)#channel-group 1 mode on(不让自动协商,否则容易出问题)
no shut
step3:观察交换机会自动生成一个虚拟的接口:
sh run
(interface port-channel 1)
sw1#show int port-channel 1
...BW 200,000Kbps
show etherchannel 1 port-channel
show etherchannel 1 summary




原文地址:https://www.cnblogs.com/sanyuanempire/p/6155127.html