前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >生成树详细配置(STP、RSTP、MSTP)

生成树详细配置(STP、RSTP、MSTP)

作者头像
可惜已不在
发布2024-10-17 16:17:11
1220
发布2024-10-17 16:17:11
举报
文章被收录于专栏:网络

一.实验内容

1)

STP配置实验

2)

RSTP配置实验

3)

MSTP配置实验

二.1 ) STP配置实验

实验拓扑

a09ccf14d628410b90f1ca1c7df56781.png
a09ccf14d628410b90f1ca1c7df56781.png

实验配置

查看 SW1~3的MAC地址

设备

MAC地址

SW1

4c1f-cc17-48bd

SW2

4c1f-ccda-40e8

SW3

4c1f-cc6c-011c

MAC地址越小越优 SW1<SW3<SW2

设备

IP地址

PC-1

192.168.1.1/24

PC-2

192.168.1.2/24

SW1:

un ter mo

sys

sys SW1

vlan 10

int vlan 10

int g0/0/1

port l t

port trunk all vlan all

int g0/0/2

port l t

port trunk all vlan all

q

stp enable

stp mode stp

SW2:

un ter mo

sys

sys SW2

vlan 10

int vlan 10

int g0/0/01

port l acc

port d vlan 10

int g0/0/2

port l t

port trunk all vlan all

int g0/0/3

port l t

port trunk all vlan all

q

stp enable

stp mode stp

SW3:

un ter mo

sys

sys SW3

vlan 10

int g0/0/2

port l acc

port d vlan 10

int g0/0/1

port l t

port trunk all vlan all

int g0/0/3

port l t

port trunk all vlan all

q

stp enable

stp mode stp

查看端口状态

SW1:

daeb14d4958749238509ae6e976bb5cb.png
daeb14d4958749238509ae6e976bb5cb.png

SW2:

5dd04ea433a34723922211721dbb55cb.png
5dd04ea433a34723922211721dbb55cb.png

SW3:

7fe302417db84dfab98c6ddbc7cf66ee.png
7fe302417db84dfab98c6ddbc7cf66ee.png

实验结果

MAC地址越小越优

1 ) 优先级:SW1>SW3>SW2

2 ) SW2的G0/0/3端口是ROOT备选口

3 ) STP的缺点就是状态变化时间太长

2 ) RSTP配置实验

实验拓扑

40d007c49c39457cb326059a1fd83086.png
40d007c49c39457cb326059a1fd83086.png

内容与STP一样,只需要更改stp的类型即可,更改SW2为根交换机,SW1为备交换机

secondary (优先级为4096) primary (优先级为0)

实验配置

SW1:

stp mode rstp

stp root secondary

SW2:

stp mode rstp

stp root primary

SW3:

stp mode rstp

再查看端口状态时(可以与上方的自行比较)

SW1:

44651fbb06bb4a3ba2d60d64ffec8bee.png
44651fbb06bb4a3ba2d60d64ffec8bee.png

SW2:

ede5d93c9acd42a78b4038d3ad9ad5b0.png
ede5d93c9acd42a78b4038d3ad9ad5b0.png

SW3:

acb7e62cadd9403a8ef26ad4938a2bdf.png
acb7e62cadd9403a8ef26ad4938a2bdf.png

实验结果

优先级:

SW2 > SW1 > SW3

1) 根据是否转发用户流量和学习MAC地址进行划分;由原来的5种缩减为3种

2) 新添加端口角色

端口类型

备份端口

作用

Aternate prot 替代端口

RP的备份

Alternate端口提供了从指定桥到根的另一条可切换路径,作为根端口的备份端口

Back port 备份端口

DP的备份

Backup端口作为指定端口的备份,提供了另一条从根桥到相应网段的备份通路

3 ) MSTP配置实验

实验拓扑

4a9bd3990f444e009afce4dad614571c.png
4a9bd3990f444e009afce4dad614571c.png

实验配置

设备

IP地址

子网掩码

网关

所属VLAN

PC-1

192.168.10.10

255.255.255.0

192.168.10.254

VLAN 10

PC-2

192.168.20.20

255.255.255.0

192.168.20.254

VLAN 20

查看 SW 1~4 的MAC地址

设备

MAC地址

SW 1

4c1f-ccca-66f6

SW 2

4c1f-cc8c-68e1

SW 3

4c1f-cc1c-344f

SW 4

4c1f-cc44-413d

SW1:

un ter mo

sys

sys SW1

vlan ba 10 20

port-group 1

group-m g0/0/3

group-m g0/0/5

group-m g0/0/2

port l t

port trunk all vlan all

q

stp enable

stp mode mstp

SW2:

un ter mo

sys

sys SW2

vlan ba 10 20

port-group 2

group-m g0/0/3

group-m g0/0/2

group-m g0/0/6

port l t

port trunk all vlan all

q

stp enable

stp mode mstp

SW3:

un ter mo

sys

sys SW3

vlan ba 10 20

int vlan 10

ip add 192.168.10.254 24

int vlan 20

ip add 192.168.20.254 24

q

port-group 3

group-m g0/0/2

group-m g0/0/4

group-m g0/0/6

port l t

port trunk all vlan all

q

int g0/0/1

port l acc

port d vlan 10

q

stp enable

stp mode mstp

SW4:

un ter mo

sys

sys SW4

vlan ba 10 20

int vlan 10

ip add 192.168.10.254 24

int vlan 20

ip add 192.168.20.254 24

q

port-group 4

group-m g0/0/2

group-m g0/0/4

group-m g0/0/5

port l t

port trunk all vlan all

q

int g0/0/1

port l acc

port d vlan 20

q

stp enable

stp mode mstp

查看交换机在生成树中的角色

1c962d05d71846229ca6b1f443702270.png
1c962d05d71846229ca6b1f443702270.png
69b697fd27c14036b7a35dc382cf0d01.png
69b697fd27c14036b7a35dc382cf0d01.png
2721381197ca468fbc2aea555a7fa9a1.png
2721381197ca468fbc2aea555a7fa9a1.png
bafa6100cbed4120bd34175d0284e3f1.png
bafa6100cbed4120bd34175d0284e3f1.png

优先级:(SW3 > SW4 > SW2 > SW1)

配置MSTP

VLAN10的根交换机为 SW1,备交换机为SW3为4096,从交换机为SW4优先级为8192,SW2默认优先级即可

VLAN20的根交换机为 SW2,备交换机为SW4为4096,从交换机为SW3优先级为8192,SW1默认优先级即可

SW1:

stp region-configuration

region-name huawei

revision-level 1

instance 1 vlan 10

instance 2 vlan 20

active region-configuration

q

stp instance 1 priority 0

SW2:

stp region-configuration

in 1 vlan 10

in 2 vlan 20

re huawei

revision-level 1

active region-configuration

q

stp instance 2 priority 0

SW3:

stp region-configuration

in 1 vlan 10

in 2 vlan 20

re huawei

rev 1

active re

q

stp instance 1 priority 4096

stp instance 2 priority 8192

SW4:

stp re

in 1 vlan 10

in 2 vlan 20

re huawei

rev 1

active re

q

stp in 2 p 4096

stp in 1 p 8192

实验结果

可以自行对照上面

SW1

3b294bc6a70b4b6a83aa979c5df6b536.png
3b294bc6a70b4b6a83aa979c5df6b536.png

SW2

bf94e57e0d2f43bc82079bb1628dbd12.png
bf94e57e0d2f43bc82079bb1628dbd12.png

SW3

230b67c919824aaaa5b963a85a4fa588.png
230b67c919824aaaa5b963a85a4fa588.png

SW4

c820538b7d494a2b93a84adf97f6a307.png
c820538b7d494a2b93a84adf97f6a307.png

三实验总结

通过上述实验得出的结论

STP不足:状态多,反应时间长,网络出现问题需要等待很长时间

RSTP不足:流量无法负载分担 二层次优路径

MSTP优点:可以快速收敛,提供了数据多个路径,实现了VLAN间数据的负载均衡

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-09-17,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一.实验内容
  • 二.1 ) STP配置实验
    • 2 ) RSTP配置实验
      • 3 ) MSTP配置实验
      • 三实验总结
      相关产品与服务
      负载均衡
      负载均衡(Cloud Load Balancer,CLB)提供安全快捷的四七层流量分发服务,访问流量经由 CLB 可以自动分配到多台后端服务器上,扩展系统的服务能力并消除单点故障。轻松应对大流量访问场景。 网关负载均衡(Gateway Load Balancer,GWLB)是运行在网络层的负载均衡。通过 GWLB 可以帮助客户部署、扩展和管理第三方虚拟设备,操作简单,安全性强。
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档