华为VRRP的配置

概念

虚拟路由备份冗余协议,作用:设备的备份,网络通讯连续性 (不等于业务连续)和网络稳定性,国际公认的协议,
组播方式通过224.0.0.18转发
运行:组号VRID ,一组有一台MASTER 可能存多个备份
虚拟IP地址,虚拟MAC 0000-5E00-01XX XX 表示组号
配置组号 虚拟IP, master 主路由
选举主和备路由器,通过VRRP优先级比较,默认优先100, 优先级大成为MASTER ,优先级相同比较
IP地址,IP地址大的成MASTER
状态:主、备,初始化
VRRP一般与MSTP联用

拓扑分析

拓扑
该网络设有四个vlan,在三层交换机配置了两个网关,一个为主一个为备,其中vlan2和vlan3的主网关为LSW1,备网关为LSW2,vlan3和vlan4的主网关为LSW2,备网关为LSW1,两台三层交换机通过聚合链路相连

基础配置

LSW1
由于LSW1和LSW2相同,LSW3和LSW4配置类似,这里只展示LSW1和LSW3

<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys lsw1
[lsw1]vlan batch 2 to 5
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw1]int g0/0/1
[lsw1-GigabitEthernet0/0/1]port link-type trunk 
[lsw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 5
[lsw1-GigabitEthernet0/0/1]int g0/0/22
[lsw1-GigabitEthernet0/0/22]port link-type trunk 
[lsw1-GigabitEthernet0/0/22]port trunk allow-pass vlan 2 to 5

LSW3

<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys lsw3
[lsw3]int e0/0/1
[lsw3-Ethernet0/0/1]q
[lsw3]vlan batch 2 to 5
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw3]int e0/0/1
[lsw3-Ethernet0/0/1]port link-type trunk 
[lsw3-Ethernet0/0/1]port trunk allow-pass vlan 2 to 5
[lsw3-Ethernet0/0/1]int e0/0/22
[lsw3-Ethernet0/0/22]port link-type trunk 
[lsw3-Ethernet0/0/22]port trunk allow-pass vlan 2 to5
                                                  ^
Error: Wrong parameter found at '^' position.
[lsw3-Ethernet0/0/22]port trunk allow-pass vlan 2 to 5
[lsw3-Ethernet0/0/22]int e0/0/2
[lsw3-Ethernet0/0/2]port link-type access
[lsw3-Ethernet0/0/2]port default vlan 2
[lsw3-Ethernet0/0/2]int e0/0/3
[lsw3-Ethernet0/0/3]port link-type access
[lsw3-Ethernet0/0/3]port default vlan 3

聚合链路eth-trunk

[lsw1]int eth-trunk 1
[lsw1-Eth-Trunk1]mode lacp
[lsw1-Eth-Trunk1]trunkport g0/0/23
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw1-Eth-Trunk1]trunkport g0/0/24
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw1-Eth-Trunk1]port link-type trunk 
[lsw1-Eth-Trunk1]port trunk allow-pass vlan 2 to 5

lsw1和lsw2相同,不做演示
查看基础配置是否正确
在这里插入图片描述

配置VRRP

[lsw1]int vlan 2
[lsw1-Vlanif2]ip add 192.168.2.253 24
[lsw1-Vlanif2]vrrp vrid 2 vir	
[lsw1-Vlanif2]vrrp vrid 2 virtual-ip 192.168.2.254
[lsw1-Vlanif2]vrrp vrid 2 pr	
[lsw1-Vlanif2]vrrp vrid 2 priority	
[lsw1-Vlanif2]vrrp vrid 2 preempt-mode	
[lsw1-Vlanif2]vrrp vrid 2 priority 150
[lsw1-Vlanif2]int vlan 3
[lsw1-Vlanif3]ip add 192.168.3.253 24
[lsw1-Vlanif3]vrrp vrid 3 vir	
[lsw1-Vlanif3]vrrp vrid 3 virtual-ip 192.168.3.254
[lsw1-Vlanif3]vrrp vrid 3 pr	
[lsw1-Vlanif3]vrrp vrid 3 priority 150
[lsw1-Vlanif3]int vlan 4
[lsw1-Vlanif4]ip add 192.168.4.253 24
[lsw1-Vlanif4]vrrp vrid 4 pe	
[lsw1-Vlanif4]vrrp vrid 4 pri	
[lsw1-Vlanif4]vrrp vrid 4 vir	
[lsw1-Vlanif4]vrrp vrid 4 virtual-ip 192.168.4.254
[lsw1-Vlanif4]int vlan 5
[lsw1-Vlanif5]ip add 192.168.5.253 24
[lsw1-Vlanif5]
[lsw1-Vlanif5]vrrp vrid 5 vir	
[lsw1-Vlanif5]vrrp vrid 5 virtual-ip 192.168.5.254

默认优先级为100,优先级越大越优先,因此我设置主网关优先级为150,备份网关可不用设置优先级

[lsw2]int vlan 2
[lsw2-Vlanif2]ip add 192.168.2.252 24
[lsw2-Vlanif2]vrrp vrid 2 vir	
[lsw2-Vlanif2]vrrp vrid 2 virtual-ip 192.168.2.254
[lsw2-Vlanif2]int vlan 3
[lsw2-Vlanif3]ip add 192.168.3.252 24
[lsw2-Vlanif3]vrrp vrid 3 virtual-ip 192.168.3.254
[lsw2-Vlanif3]int vlan 4
[lsw2-Vlanif4]ip add 192.168.4.252 24
[lsw2-Vlanif4]vrrp vrid 4 virtual-ip  192.168.4.254
[lsw2-Vlanif4]vrrp vrid 4 priority 150
[lsw2-Vlanif4]int vlan 5
[lsw2-Vlanif5]ip add 192.168.5.252 24
[lsw2-Vlanif5]vrrp vrid 5 virtual-ip 192.168.5.254
[lsw2-Vlanif5]vrrp vrid 5 priority 150

验证

LSW1
在这里插入图片描述lsw2
在这里插入图片描述关掉LSW1,查看LSW2
在这里插入图片描述主备切换成功

在聚合链路抓包
在这里插入图片描述显示抓到组播包,实验完成

猜你喜欢

转载自blog.csdn.net/caolongbin/article/details/127175323