NA Second Journey difficult: STP learning

Please

Principles outlined

STP logical loop is used to avoid protocol data link layer occurs, the device discovery loop running STP by exchanging information, and by blocking the specific port, the network structure will eventually trimmed into a loop-free tree structure. When a network failure, STP can quickly detect link failures, and find another path for data transmission as soon as possible.
STP running on the switch interactively, root switch election BPDU information, and select switch for each non-root root root switch port in communication with, after each selected segment data to a designated port for forwarding the root switch, and finally The remaining ports were blocked.

Topology:

NA Second Journey difficult: STP learning

basic configuration

S1 to S4 will change the default MSTP to STP

stp enable
stp mode stp

After 30 seconds the spanning tree status s1 view
detail Status

display stp

View summary information

[s1]display stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               ROOT  FORWARDING      NONE
   0    Ethernet0/0/2               ALTE  DISCARDING      NONE
[s2]display stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               DESI  FORWARDING      NONE
   0    Ethernet0/0/2               DESI  FORWARDING      NONE
   0    Ethernet0/0/3               DESI  FORWARDING      NONE
[s3]display stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               DESI  FORWARDING      NONE
   0    Ethernet0/0/2               DESI  FORWARDING      NONE
   0    Ethernet0/0/3               ROOT  FORWARDING      NONE
   0    Ethernet0/0/10              DESI  FORWARDING      NONE
   0    Ethernet0/0/11              DESI  FORWARDING      NONE
[s4]display stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               ALTE  DISCARDING      NONE
   0    Ethernet0/0/2               ROOT  FORWARDING      NONE

From the above
Ethernet0 S1 / 0/1 is the root port, forwarding state; Ethernet0 / 0/2 as an alternative port, discard state
all ports S2 are designated ports, forwarding state; S2 can be determined as the root switch
S3 is Ethernet0 / 0/3 is a root port, a designated port for the remaining ports; forwarding state are
Ethernet0 / 0/2 is the root port S4, the forwarding state; Ethernet0 / 0/1 as an alternative port, discard state

View details stp root switch s2

[s2]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge         :32768.4c1f-cc29-7f53
Config Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC      :32768.4c1f-cc29-7f53 / 0
CIST RegRoot/IRPC   :32768.4c1f-cc29-7f53 / 0
CIST RootPortId     :0.0
BPDU-Protection     :Disabled
TC or TCN received  :18
TC count per hello  :0
STP Converge Mode   :Normal 
Time since last TC  :0 days 0h:4m:29s
Number of TC        :19
Last TC occurred    :Ethernet0/0/3

Ps: CIST Root / ERPC CIST Bridge the same description as the root switch s2; 32768.4c1f-cc29-7f53 32768 in default priority for the switch, the switch back to the MAC address

STP Operation

Comparative ID root switch election each switch, the switch ID of the switch MAC address and priority of
1, the lowest priority comparing switches, the value for the root switch
2, same priority, the MAC address comparison, the lowest value for the root switch .

Root switch manually configure

Modify priority of a switch
provided root switch priority is 0, the priority root switch 4096

[s1]stp priority 0
[s2]stp priority 4096

or

[s1]undo stp priority
[s1]stp root primary 
[s2]undo stp priority
[s2]stp root secondary 

View s1s2 status information

[s1]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge         :0    .4c1f-cce4-0451
Config Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC      :0    .4c1f-cce4-0451 / 0
CIST RegRoot/IRPC   :0    .4c1f-cce4-0451 / 0
[s2]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge         :4096 .4c1f-cc29-7f53
Config Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC      :0    .4c1f-cce4-0451 / 200000
CIST RegRoot/IRPC   :4096 .4c1f-cc29-7f53 / 0

由以上可知
CIST Root/ERPC:根交换机s1优先级为0,mac为4c1f-cce4-0451
CIST RegRoot/IRPC:备份根交换机s2优先级为4096,mac为4c1f-cc29-7f53

非根交换机上选举根端口

1、每个端口到达根交换机的根路径开销,路径开销最小的端口为根端口
2、如果根路径开销值相同,则比较每个端口所在链路上行交换机ID值
3、如果上行交换机ID相同,则比较每个端口所在链路上行端口ID值

手动配置端口开销值
查看s4交换机根端口以及开销值

[s4]dis stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               ALTE  DISCARDING      NONE
   0    Ethernet0/0/2               ROOT  FORWARDING      NONE
[s4]dis stp
----[Port1(Ethernet0/0/1)][DISCARDING]----
 Port Protocol       :Enabled
 Port Role           :Alternate Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=200000
----[Port2(Ethernet0/0/2)][FORWARDING]----
 Port Protocol       :Enabled
 Port Role           :Root Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=200000

两个端口的active(实际使用的开销值)都为200000,设置根端口的开销值小于200000,即可

配置s4上根端口开销值

[s4]interface Eth0/0/1
[s4-Ethernet0/0/1]stp cost 2000

再次查看s4交换机根端口

[s4]dis stp
----[Port1(Ethernet0/0/1)][FORWARDING]----
 Port Protocol       :Enabled
 Port Role           :Root Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=2000 / Active=2000
----[Port2(Ethernet0/0/2)][DISCARDING]----
 Port Protocol       :Enabled
 Port Role           :Alternate Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=200000

目前根端口为Ethernet0/0/1口,开销值为2000

每个网段选举指定端口
1、比较两个端口发送与接收BPDU中的根路径开销,小的成为指定端口
2、如果相同,比较端口发送与接收BPDU中的网桥ID,小的成为指定端口
3、如果相同,比较网桥MAC地址,小的成为指定端口

Ps:修改端口开销值来选举指定端口,修改方法同选举根端口

配置STP定时器

普通的stp不能实现快速的拓扑收敛,但定时器通过配置合适的系统参数,可以使stp实现最快的拓扑收敛。
定时器有三种:
hello time定时器,BPDU多久发送一次hello,默认2秒
max age定时器,BPDU的最大老化时间,默认20秒
forword delay定时器,转发延迟时间;接口从Discarding状态,经过 过渡状态,最终到Forwording状态所用时间,默认15秒
交换机自动根据网络直径计算出hello time,max age和forword delay三个时间参数的最优值,默认网络直径为7

示例:
NA Second Journey difficult: STP learning

配置STP定时器,并配置s1为根交换机,s2为备份根交换机

[s1]stp mode stp
[s1]stp root primary 
[s2]stp mode stp
[s2]stp root secondary 
[s3]stp mode stp
[s4]stp mode stp

查看各定时器默认值

[s1]display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge         :0    .4c1f-cc9a-76a3
Config Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20

Config Times:标识当前设备配置的计时器
Active Times:标识正在生效的计时器

在根交换机设置FwDly时间为2000cs,默认是1500cs,cs是百分之一秒

stp timerforward-delay 2000

一般不建议直接修改这三个计时器的数值,而是配置网络直径让交换机自行计算
在根交换机配置网络直径为3

stp bridge-diameter 3

再次查看计时器信息

<s1>display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge         :0    .4c1f-cc9a-76a3
Config Times        :Hello 2s MaxAge 12s FwDly 9s MaxHop 20
Active Times        :Hello 2s MaxAge 12s FwDly 9s MaxHop 20

RSTP

RSTP(快速生成树协议)基于STP协议,在STP协议的端口状态和端口角色进行了细致区分,使收敛速度有很大提升。

RSTP与STP的比较

NA Second Journey difficult: STP learning

RSTP的快速收敛机制

• Proposal/Agreement机制
• 根端口快速切换机制
• 边缘端口的引入

示例:
NA Second Journey difficult: STP learning

在s1到s4交换机配置RSTP

[s1]stp mode rstp

配置s1为根交换机,s2为备份根交换机

[s1]stp root primary
[s2]stp root secondary 

配置s3的Ethernet0/0/1,s4的Ethernet0/0/1为边缘端口

[s3-Ethernet0/0/1]stp edged-port enable 
[s4-Ethernet0/0/1]stp edged-port enable 

MSTP

RSTP to achieve a rapid convergence of the network topology, but still flawed, that the contribution of all VLAN spanning tree within a local area network, the link does not carry any traffic will be blocked, resulting in a waste of bandwidth, and therefore can not load data traffic between VLAN balanced, it may also cause some VLAN packets can not be forwarded.
MSTP divides a switching network into a plurality of regions, each forming a plurality of spanning trees, the spanning tree independent of one another. Each region is called a MST region, each spanning tree is called an MSTI MSTI; may comprise a plurality of the VLAN instance, by VLAN mapping table, and VLAN to MSTI link; may correspond to a plurality of MSTI VLAN, a VLAN It corresponds to only one MSTI.

Example:
NA Second Journey difficult: STP learning

Basic Configuration

Example s1 to
configure vlan 10 20, pc is connected to a port access, the configuration of the switch is connected to trunk ports

[s1]vlan batch 10 20
[s1-Ethernet0/0/1]port link-type trunk 
[s1-Ethernet0/0/1]port trunk allow-pass vlan 10 20
[s1-Ethernet0/0/2]port link-type trunk 
[s1-Ethernet0/0/2]port trunk allow-pass vlan 10 20
[s1-Ethernet0/0/3]port link-type access 
[s1-Ethernet0/0/3]port default vlan 10

Configuring multiple instances on MSTP s1, s2, s3

进入MSTP域视图
[s1]stp region-configuration
配置MSTP域域名
[s1-mst-region]region-name huawei
配置MSTP的修订级别为1
[s1-mst-region]revision-level 1
指定vlan10映射到MSTI1,指定vlan20映射到MSTI2
[s1-mst-region]instance 1 vlan 10
[s1-mst-region]instance 2 vlan 20
激活MST域配置
[s1-mst-region]active region-configuration

Notes: In the same MST region, must have the same name, revision level, and VLAN mapping to the MSTI

MST region view the current configuration

<s1>dis stp region-configuration 
 Oper configuration
   Format selector    :0             
   Region name        :huawei             
   Revision level     :1

   Instance   VLANs Mapped
      0       1 to 9, 11 to 19, 21 to 4094
      1       10
      2       20

The spanning tree status and statistics of s1, s2, s3 view three examples of summary information

[s1]dis stp instance 0 brief
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               ROOT  FORWARDING      NONE
   0    Ethernet0/0/2               ALTE  DISCARDING      NONE
   0    Ethernet0/0/3               DESI  FORWARDING      NONE
[s1]dis stp instance 1 brief
 MSTID  Port                        Role  STP State     Protection
   1    Ethernet0/0/1               ROOT  FORWARDING      NONE
   1    Ethernet0/0/2               ALTE  DISCARDING      NONE
   1    Ethernet0/0/3               DESI  FORWARDING      NONE
[s1]dis stp instance 2 brief
 MSTID  Port                        Role  STP State     Protection
   2    Ethernet0/0/1               ROOT  FORWARDING      NONE
   2    Ethernet0/0/2               ALTE  DISCARDING      NONE

It can be seen that the switch s1 Ethernet0 / 0/2 port in Examples 1 and 2 are in a state DISCARDING to achieve this link is utilized, arranged in the switch s1 in Example 2 as the root switch

[s1]stp instance 2 priority 0

Displays the spanning tree status and statistics summary information again

[s1]dis stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               ROOT  FORWARDING      NONE
   0    Ethernet0/0/2               ALTE  DISCARDING      NONE
   0    Ethernet0/0/3               DESI  FORWARDING      NONE
   1    Ethernet0/0/1               ROOT  FORWARDING      NONE
   1    Ethernet0/0/2               ALTE  DISCARDING      NONE
   1    Ethernet0/0/3               DESI  FORWARDING      NONE
   2    Ethernet0/0/1               DESI  FORWARDING      NONE
   2    Ethernet0/0/2               DESI  FORWARDING      NONE

Can be seen, Ethernet0 / 0/2 port specified in Example 2, the FORWARDING state, to achieve the purpose of traffic sharing, effective use of network resources so that the uplink two mutual backup may s1

Learning from Huawei Technologies Laboratory Manual network technology certification HCNA

Guess you like

Origin blog.51cto.com/jiayimeng/2446953