服务器 运维 eNSP 华为 配置MSTP+VRRP+OSPF路由 组合组网 典型配置 - [sw1-ospf-1]area 0

📅 2026-11-30 👤 拼多多助力营销技巧 📂 拼多多助力 👁️ 148 次阅读

1 网络中部署VRRP负载分担时,多台设备同时承担业务,每个虚拟设备都包括一个Master设备和若干个Backup设备。如果为了接入备份需要同时部署冗余链路,则需要部署MSTP消除网络中的环路,保证流量的负载分担。

2实验拓补

3基本配置

#sw1

sys

[Huawei]sysname sw1

[sw1]int Eth-Trunk 1

[sw1-Eth-Trunk1]port link-type trunk

[sw1-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/2

[sw1-Eth-Trunk1]dis eth-trunk 1

Eth-Trunk1's state information is:

WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP

Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8

Operate status: up Number Of Up Port In Trunk: 2

--------------------------------------------------------------------------------

PortName Status Weight

GigabitEthernet0/0/1 Up 1

GigabitEthernet0/0/2 Up 1

[sw1-Eth-Trunk1]port trunk allow-pass vlan 6 7 8 9

[sw1-Eth-Trunk1]qu

[sw1]vlan batch 6 7 8 9 10

[sw1]int GigabitEthernet 0/0/3

[sw1-GigabitEthernet0/0/3]port link-type trunk

[sw1-GigabitEthernet0/0/3]qu

[sw1]int GigabitEthernet 0/0/4

[sw1-GigabitEthernet0/0/4]port link-type trunk

[sw1-GigabitEthernet0/0/4]qu

[sw1]int GigabitEthernet 0/0/5

[sw1-GigabitEthernet0/0/5]port link-type access

[sw1-GigabitEthernet0/0/5]port default vlan 10

[sw1-GigabitEthernet0/0/5]qu

#配置vrrp

[sw1]int Vlanif 6

[sw1-Vlanif6]ip address 192.168.6.1 24

[sw1-Vlanif6]vrrp vrid 6 virtual-ip 192.168.6.254

[sw1-Vlanif6]vrrp vrid 6 priority 120

[sw1-Vlanif6]vrrp vrid 6 preempt-mode timer delay 9

[sw1-Vlanif6]vrrp vrid 6 timer advertise 9

[sw1-Vlanif6]vrrp vrid 6 track interface GigabitEthernet 0/0/5 reduced 80

[sw1-Vlanif6]qu

[sw1]int vlan 7

[sw1-Vlanif7]ip address 192.168.7.1 24

[sw1-Vlanif7]vrrp vrid 7 virtual-ip 192.168.7.254

[sw1-Vlanif7]vrrp vrid 7 timer advertise 9

[sw1-Vlanif7]vrrp vrid 7 preempt-mode timer delay 9

[sw1-Vlanif7]qu

[sw1]int Vlanif 8

[sw1-Vlanif8]vrrp vrid 8 virtual-ip 192.168.8.254

[sw1-Vlanif8]vrrp vrid 8 timer advertise 9

[sw1-Vlanif8]vrrp vrid 8 preempt-mode timer delay 9

[sw1-Vlanif8]ip add 192.168.8.1 24

[sw1-Vlanif8]qu

[sw1]int GigabitEthernet 0/0/3

[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan all

[sw1-GigabitEthernet0/0/3]qu

[sw1]int GigabitEthernet 0/0/4

[sw1-GigabitEthernet0/0/4]port trunk allow-pass vlan all

[sw1-GigabitEthernet0/0/4]qu

#sw2

sys

[Huawei]sysname sw2

[sw2]int Eth-Trunk 1

[sw2-Eth-Trunk1]port link-type trunk

[sw2-Eth-Trunk1]port trunk allow-pass vlan 6 7 8 9

[sw2]vlan batch 6 7 8 9 20

[sw2]dis eth-trunk 1

Eth-Trunk1's state information is:

WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP

Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8

Operate status: up Number Of Up Port In Trunk: 2

--------------------------------------------------------------------------------

PortName Status Weight

GigabitEthernet0/0/1 Up 1

GigabitEthernet0/0/2 Up 1

[sw2-Eth-Trunk1]qu

[sw2]vlan batch 6 7 8 9 20

[sw2]int GigabitEthernet 0/0/3

[sw2-GigabitEthernet0/0/3]port link-type trunk

[sw2-GigabitEthernet0/0/3]qu

[sw2]int GigabitEthernet 0/0/4

[sw2-GigabitEthernet0/0/4]port link-type trunk

[sw2-GigabitEthernet0/0/4]qu

[sw2]int GigabitEthernet 0/0/5

[sw2-GigabitEthernet0/0/5]port link-type access

[sw2-GigabitEthernet0/0/5]port default vlan 20

[sw2-GigabitEthernet0/0/5]qu

#配置vrrp

[sw2]int Vlanif 6

[sw2-Vlanif6]ip address 192.168.6.2 24

[sw2-Vlanif6]vrrp vrid 6 virtual-ip 192.168.6.254

[sw2-Vlanif6]vrrp vrid 6 preempt-mode timer delay 9

[sw2-Vlanif6]vrrp vrid 6 timer advertise 9

[sw2-Vlanif6]qu

[sw2]int Vlanif 7

[sw2-Vlanif7]ip add 192.168.7.2 24

[sw2-Vlanif7]vrrp vrid 7 virtual-ip 192.168.7.254

[sw2-Vlanif7]vrrp vrid 7 preempt-mode timer delay 9

[sw2-Vlanif7]vrrp vrid 7 timer advertise 9

[sw2-Vlanif7]vrrp vrid 7 priority 120

[sw2-Vlanif7]vrrp vrid 7 track interface GigabitEthernet 0/0/5 reduced 80

[sw2-Vlanif7]qu

[sw2]int Vlanif 8

[sw2-Vlanif8]vrrp vrid 8 virtual-ip 192.168.8.254

[sw2-Vlanif8]ip add 192.168.8.2 24

[sw2-Vlanif8]vrrp vrid 8 preempt-mode timer delay 9

[sw2-Vlanif8]vrrp vrid 8 priority 120

[sw2-Vlanif8]vrrp vrid 8 timer advertise 9

[sw2-Vlanif8]vrrp vrid 8 track interface GigabitEthernet 0/0/5 reduced 80

[sw2-Vlanif8]qu

[sw2]int GigabitEthernet 0/0/3

[sw2-GigabitEthernet0/0/3]port trunk allow-pass vlan all

[sw2-GigabitEthernet0/0/3]qu

[sw2]int GigabitEthernet 0/0/4

[sw2-GigabitEthernet0/0/4]port trunk allow-pass vlan all

[sw2-GigabitEthernet0/0/4]qu

#sw3

sys

[Huawei]sysname sw3

[sw3]int Ethernet 0/0/1

[sw3-Ethernet0/0/1]port link-type trunk

[sw3-Ethernet0/0/1]qu

[sw3]int Ethernet 0/0/2

[sw3-Ethernet0/0/2]port link-type trunk

[sw3-Ethernet0/0/2]qu

[sw3]vlan batch 6 7 8 10 20

[sw3]int Ethernet 0/0/3

[sw3-Ethernet0/0/3]port link-type access

[sw3-Ethernet0/0/3]port default vlan 6

[sw3-Ethernet0/0/3]stp edged-port enable

[sw3-Ethernet0/0/3]qu

[sw3]int Ethernet 0/0/4

[sw3-Ethernet0/0/4]port link-type access

[sw3-Ethernet0/0/4]port default vlan 7

[sw3-Ethernet0/0/4]stp edged-port enable

[sw3-Ethernet0/0/4]qu

[sw3]int Ethernet 0/0/5

[sw3-Ethernet0/0/5]port link-type access

[sw3-Ethernet0/0/5]port default vlan 8

[sw3-Ethernet0/0/5]stp edged-port enable

[sw3-Ethernet0/0/5]qu

[sw3]int Ethernet 0/0/1

[sw3-Ethernet0/0/1]port trunk allow-pass vlan 6 7 8

[sw3-Ethernet0/0/1]qu

[sw3]int Ethernet 0/0/2

[sw3-Ethernet0/0/2]port trunk allow-pass vlan 6 7 8

[sw3-Ethernet0/0/2]qu

#sw4

sys

[Huawei]sysname sw4

[sw4-Ethernet0/0/2]]int Ethernet 0/0/2

[sw4-Ethernet0/0/2]port link-type trunk

[sw4-Ethernet0/0/2]qu 拼多多帮助力入口

[sw4]int Ethernet 0/0/1

[sw4-Ethernet0/0/1]port link-type trunk

[sw4-Ethernet0/0/1]qu

[sw4]vlan batch 6 7 8 10 20

[sw4]int Ethernet 0/0/3

[sw4-Ethernet0/0/3]port lin

[sw4-Ethernet0/0/3]port link-ty

[sw4-Ethernet0/0/3]port link-type ac

[sw4-Ethernet0/0/3]port link-type access

[sw4-Ethernet0/0/3]po

May 6 2024 17:45:05-08:00 sw4 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25

.191.3.1 configurations have been changed. The current change number is 10, the

change loop count is 0, and the maximum number of records is 409

[sw4-Ethernet0/0/3]port de

[sw4-Ethernet0/0/3]port default vlan 6

[sw4-Ethernet0/0/3]stp edged-port enable

[sw4-Ethernet0/0/3]qu

[sw4]int Ethernet 0/0/4

[sw4-Ethernet0/0/4]port link-type access

[sw4-Ethernet0/0/4]port default vlan 7

[sw4-Ethernet0/0/4]stp edged-port enable

[sw4-Ethernet0/0/4]qu

[sw4]int Ethernet 0/0/5

[sw4-Ethernet0/0/5]port link-type access

[sw4-Ethernet0/0/5]port default vlan 8

[sw4-Ethernet0/0/5]stp edged-port enable

[sw4-Ethernet0/0/5]qu

[sw4]int Ethernet 0/0/1

[sw4-Ethernet0/0/1]port trunk allow-pass vlan 6 7 8

[sw4-Ethernet0/0/1]qu

[sw4]int Ethernet 0/0/2

[sw4-Ethernet0/0/2]port trunk allow-pass vlan 6 7 8

[sw4-Ethernet0/0/2]qu

4配置MSTP

#sw1

[sw1]stp region-configuration //进入MST域视图

[sw1-mst-region]region-name HW1 //配置域名为HW1

[sw1-mst-region]instance 1 vlan 6 //将VLAN 6映射到实例1上。

[sw1-mst-region]instance 2 vlan 7 8

[sw1-mst-region]active region-configuration //激活MST域的配置

[sw1-mst-region]qu

[sw1]stp root primary

[sw1]stp enable

#sw2

[sw2]stp region-configuration

[sw2-mst-region]region-name HW1

[sw2-mst-region]instance 1 vlan 6

[sw2-mst-region]instance 2 vlan 7 8

[sw2-mst-region]active region-configuration

[sw2-mst-region]qu

[sw2]stp root secondary

[sw2]stp enable

#sw3

[sw3]stp region-configuration

[sw3-mst-region]region-name HW1

[sw3-mst-region]instance 1 vlan 6

[sw3-mst-region]instance 2 vlan 7 8

[sw3-mst-region]active region-configuration

[sw3-mst-region]qu

[sw3]stp instance 1 root primary

[sw3]stp instance 2 root secondary

[sw3]stp enable

#sw4

[sw4]stp region-configuration

[sw4-mst-region]region-name HW1

[sw4-mst-region]instance 1 vlan 6

[sw4-mst-region]instance 2 vlan 7 8

[sw4-mst-region]active region-configuration

[sw4-mst-region]qu

[sw4]stp instance 2 root primary

[sw4]stp instance 1 root secondary

[sw4]stp enable

5 配置ospf路由

#sw1

[sw1]int vlan 10

[sw1-Vlanif10]ip add 192.168.10.1 30

[sw1-Vlanif10]qu

[sw1]int GigabitEthernet 0/0/5

[sw1-GigabitEthernet0/0/5]port link-type access

[sw1-GigabitEthernet0/0/5]port default vlan 10

[sw1-GigabitEthernet0/0/5]qu

[sw1]ospf 1

[sw1-ospf-1]area 0

[sw1-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255

[sw1-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255

[sw1-ospf-1-area-0.0.0.0]network 192.168.8.0 0.0.0.255

[sw1-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255

[sw1-ospf-1-area-0.0.0.0]qu

[sw1-ospf-1]qu

#sw2

[sw2]int vlan 20

[sw2-Vlanif20]ip add 192.168.20.1 30

[sw2-Vlanif20]qu

[sw2]int GigabitEthernet 0/0/5

[sw2-GigabitEthernet0/0/5]port link-type access

[sw2-GigabitEthernet0/0/5]port default vlan 20

[sw2-GigabitEthernet0/0/5]qu

[sw2]ospf 1

[sw2-ospf-1]area 0

[sw2-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255

[sw2-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255

[sw2-ospf-1-area-0.0.0.0]network 192.168.8.0 0.0.0.255

[sw2-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255

[sw2-ospf-1-area-0.0.0.0]qu

[sw2-ospf-1]qu

#R1

sys

[Huawei]sysname R1

[R1]int LoopBack 1

[R1-LoopBack1]ip add 10.1.1.1 32

[R1-LoopBack1]qu

[R1]int GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]ip add 192.168.10.2 30

[R1-GigabitEthernet0/0/0]qu

[R1]int GigabitEthernet 0/0/1

[R1-GigabitEthernet0/0/1]ip add 192.168.20.2 30

[R1-GigabitEthernet0/0/1]qu

[R1]ospf 1

[R1-ospf-1]area 0

[R1-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255

[R1-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255

[R1-ospf-1-area-0.0.0.0]network 10.1.1.1 0.0.0.255

[R1-ospf-1-area-0.0.0.0]qu

[R1-ospf-1]qu

6验证配置结果

#在sw1上执行display stp brief命令,查看端口状态和端口的保护类型,结果如下:

# 在sw2上执行display stp brief命令

#查看VRRP,用display vrrp brief

#pc端测试连接

#pc查看流量的负载分担

#sw1模拟外网异常断开

[sw1]int GigabitEthernet 0/0/5

[sw1-GigabitEthernet0/0/5]shu

[sw1-GigabitEthernet0/0/5]shutdown

[sw1-GigabitEthernet0/0/5]qu

[sw1]dis vrrp br

VRID State Interface Type Virtual IP

----------------------------------------------------------------

6 Backup Vlanif6 Normal 192.168.6.254

7 Backup Vlanif7 Normal 192.168.7.254

8 Backup Vlanif8 Normal 192.168.8.254

----------------------------------------------------------------

Total:3 Master:0 Backup:3 Non-active:0

#看pc1的流量

#恢复sw1外网

[sw1]int GigabitEthernet 0/0/5

[sw1-GigabitEthernet0/0/5]undo shutdown

[sw1-GigabitEthernet0/0/5]qu

sw1]dis vrrp br

VRID State Interface Type Virtual IP

----------------------------------------------------------------

6 Master Vlanif6 Normal 192.168.6.254

7 Backup Vlanif7 Normal 192.168.7.254

8 Backup Vlanif8 Normal 192.168.8.254

----------------------------------------------------------------

Total:3 Master:1 Backup:2 Non-active:0

配置记得save保存哦

欢迎各位同学们,一起沟通交流哦,如有需要,可以加微信哦

相关阅读

标签: 拼多多助力网站平台 赚钱项目 拼多多助力网 首码项目 手赚APP
拼多多助力营销技巧