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

发布于:2024-09-18 ⋅ 阅读:(10) ⋅ 点赞:(0)

🐣个人主页 可惜已不在

🐤这篇在这个专栏 华为_可惜已不在的博客-CSDN博客

🐥有用的话就留下一个三连吧😼

目录

一.

实验内容

二.

1 ) STP配置实验

2 ) RSTP配置实验

3 ) MSTP配置实验

实验总结


一.

实验内容

1)

STP配置实验

2)

RSTP配置实验

3)

MSTP配置实验

二.

1 ) STP配置实验

实验拓扑

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

SW2:

5dd04ea433a34723922211721dbb55cb.png

SW3:

7fe302417db84dfab98c6ddbc7cf66ee.png

实验结果

MAC地址越小越优

1 ) 优先级:SW1>SW3>SW2 

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

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

2 ) RSTP配置实验

实验拓扑

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

SW2:

ede5d93c9acd42a78b4038d3ad9ad5b0.png

SW3:

acb7e62cadd9403a8ef26ad4938a2bdf.png

实验结果

优先级:

SW2 > SW1 > SW3

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

2) 新添加端口角色

    

端口类型 备份端口 作用
Aternate prot 替代端口
RP的备份
Alternate端口提供了从指定桥到根的另一条可切换路径,作为根端口的备份端口
Back port 备份端口
DP的备份
Backup端口作为指定端口的备份,提供了另一条从根桥到相应网段的备份通路

3 ) MSTP配置实验

实验拓扑

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

69b697fd27c14036b7a35dc382cf0d01.png

2721381197ca468fbc2aea555a7fa9a1.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

SW2

bf94e57e0d2f43bc82079bb1628dbd12.png

SW3

230b67c919824aaaa5b963a85a4fa588.png

SW4

c820538b7d494a2b93a84adf97f6a307.png

实验总结

通过上述实验得出的结论

STP不足:状态多,反应时间长,网络出现问题需要等待很长时间
RSTP不足:流量无法负载分担 二层次优路径
MSTP优点:可以快速收敛,提供了数据多个路径,实现了VLAN间数据的负载均衡


网站公告

今日签到

点亮在社区的每一天
去签到