eNSP 华为 配置MSTP+VRRP+OSPF路由 组合组网 典型配置

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

2实验拓补

3基本配置

#sw1

<Huawei>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

<Huawei>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

<Huawei>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

<Huawei>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

<Huawei>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保存哦

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

  • 34
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值