![cover](https://img-blog.csdnimg.cn/12612cc8793c4c7bb2686e4e6bab744d.png)
网工-生成树协议
网络工程师实验学习笔记-生成树
实验拓扑图:
![]() |
一、基本配置
S1
//如何关闭多余的接口举例*
[Huawei]interface GigabitEthernet 0/0/12
[Huawei-GigabitEthernet0/0/12]shutdown
[Huawei-GigabitEthernet0/0/12]q
1.全局使能stp
[Huawei]stp enable
2.修改工作模式
[Huawei]stp mode stp
Info: This operation may take a few seconds. Please wait for a moment...done.
S2
[Huawei]interface GigabitEthernet 0/0/12
[Huawei-GigabitEthernet0/0/12]shutdown
同上全局使能stp,修改其工作模式
S3
同上全局使能stp,修改其工作模式
S4
同上全局使能stp,修改其工作模式
3.查看生成树状态
S1
[Huawei]display stp
4.查看生成树状态信息摘要
四个都要查,以此判断根桥还有各部分的参数
举例S1
[Huawei]display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/1 DESI FORWARDING NONE
0 GigabitEthernet0/0/2 DESI FORWARDING NONE
0 GigabitEthernet0/0/3 ALTE DISCARDING NONE
0 GigabitEthernet0/0/4 ROOT FORWARDING NONE
5.根据摘要画出类似的逻辑拓扑
![]() |
二、控制根桥的选举
1.修改S1 S2的优先级
//指定当前交换设备为根交换设备
S1
[Huawei]stp root primary
//指定当前设备在指定生成树中为备份根桥
S2
[Huawei]stp root secondary
S1
//此时自身桥id与根桥id相同,且根路径开销为,说明S1是当前网络的根桥
[Huawei]display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :0 .4c1f-ccc3-4b89
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-ccc3-4b89 / 0
CIST RegRoot/IRPC :0 .4c1f-ccc3-4b89 / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
CIST Root Type :Primary root
TC or TCN received :111
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:1m:20s
Number of TC :16
Last TC occurred :GigabitEthernet0/0/1
----[Port1(GigabitEthernet0/0/1)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Designated Bridge/Port :0.4c1f-ccc3-4b89 / 128.1
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :147 packets/hello-time
---- More ----
注:控制根桥选举后,逻辑拓扑也会相应发生变化。可以查询各个交换机的状态信息,画出逻辑拓扑图。
三、控制端口角色
S4
//当前S4到S1根路径开销为20000
[Huawei]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :32768.4c1f-cc30-5cdb
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-ccc3-4b89 / 20000
CIST RegRoot/IRPC :32768.4c1f-cc30-5cdb / 0
CIST RootPortId :128.3
BPDU-Protection :Disabled
TC or TCN received :59
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:14m:27s
Number of TC :17
Last TC occurred :GigabitEthernet0/0/3
----[Port1(GigabitEthernet0/0/1)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=20000
Designated Bridge/Port :32768.4c1f-cc30-5cdb / 128.1
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :147 packets/hello-time
Protection Type :None
---- More ----
修改STP开销
S4
[Huawei]interface GigabitEthernet 0/0/3
[Huawei-GigabitEthernet0/0/3]stp cost 50000
实验结果:
修改过后本来0/0/3是根接口,开销越小,优先级越大,所以0/0/2就取代成为根接口。
四、修改工作模式为RSTP
四台交换机都需要修改
[Huawei]stp mode rstp
Info: This operation may take a few seconds. Please wait for a moment...done.
修改后,对生成树的整体拓扑无影响。
五、配置边缘端口
[S3]interface range GigabitEthernet 0/0/10 to GigabitEthernet 0/0/24
通常,设备的以太网接口数比较多,并且在很多以太网接口下有相同的配置。如果对这些以太网接口进行逐个配置会较为繁琐,且容易输入错误。因此,将需要执行相同配置命令的以太网接口加入到一个临时端口组,在临时端口组配置命令时,系统会自动到临时端口组绑定的所有成员接口下执行这些命令行,完成以太网接口批量配置。
注:某些产品上可能不支持临时接口组,需要对接口做单独配置。
[S3-port-group] stp edged-port enable
命令用来配置当前端口为边缘端口。当前端口配置成边缘端口后,如果收到BPDU报文,交换设备会自动将边缘端口设置为非边缘端口,并重新进行生成树计算。
更多推荐
所有评论(0)