VRRP:
虚拟 路由器 冗余 协议
virtual router redundancy protocol

VRRP :(公有协议)
在多个路由器之间运行,
可以虚拟出一个或者多个网关IP地址(虚拟路由器);
从而实现内网不同网段之间的互通;

VRRP的工作过程:
1、运行VRRP的“多个”路由器之间通过 VRRP 报文的交互,从而选择
出一个最牛的路由器,作为 Master 路由器 ,以后就用来这个设备
来转发数据包;
2、Master 路由器,仅仅只有一个;其他的路由器称之为 backup 路由器;
3、同时,Master 和 Backup 路由器,会产生一个虚拟的路由器,也就是一个
虚拟的IP地址;

 拓扑图:

华为VRRP和浮动路由配置与应用_第1张图片

     配置步骤:
 SW2:
 vlan batch 10 20 30 40 50
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.250
vrrp vrid 10 priority 120 vrrp vrid 10 track interface GigabitEthernet0/0/2 reduced 40
 interface Vlanif20
ip address 192.168.20.253 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.250
vrrp vrid 20 priority 120
vrrp vrid 20 track interface GigabitEthernet0/0/2 reduced 40
interface Vlanif30
ip address 192.168.30.253 255.255.255.0
vrrp vrid 30 virtual-ip 192.168.30.250
interface Vlanif40
ip address 192.168.40.253 255.255.255.0
vrrp vrid 40 virtual-ip 192.168.40.250
interface Vlanif50
ip address 192.168.50.1 255.255.255.0
 interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
interface GigabitEthernet0/0/2
port link-type access
port default vlan 50
 LSW3:
vlan batch 10 20 30 40 50
 interface Vlanif10
ip address 192.168.10.254 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.250
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.250
interface Vlanif30
ip address 192.168.30.254 255.255.255.0
vrrp vrid 30 virtual-ip 192.168.30.250
vrrp vrid 30 priority 120
vrrp vrid 30 track interface GigabitEthernet0/0/2 reduced 30
interface Vlanif40
ip address 192.168.40.254 255.255.255.0
vrrp vrid 40 virtual-ip 192.168.40.250
vrrp vrid 40 priority 120
vrrp vrid 40 track interface GigabitEthernet0/0/2 reduced 30
interface Vlanif50
ip address 192.168.60.1 255.255.255.0
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
interface GigabitEthernet0/0/2
port link-type access
port default vlan 50
LSW4:
vlan batch 10 20 30 40
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
interface GigabitEthernet0/0/3
port link-type access
port default vlan 30
interface GigabitEthernet0/0/4
port link-type access
port default vlan 40
interface GigabitEthernet0/0/5
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
interface GigabitEthernet0/0/6
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
 AR1:
interface GigabitEthernet0/0/0
ip address 192.168.50.2 255.255.255.0 
interface GigabitEthernet0/0/1
ip address 192.168.60.2 255.255.255.0 
浮动路由:
ip route-static 192.168.10.0 255.255.255.0 192.168.50.1
ip route-static 192.168.10.0 255.255.255.0 192.168.60.1 preference 100
ip route-static 192.168.20.0 255.255.255.0 192.168.50.1
ip route-static 192.168.20.0 255.255.255.0 192.168.60.1 preference 100
ip route-static 192.168.30.0 255.255.255.0 192.168.50.1 preference 100
ip route-static 192.168.30.0 255.255.255.0 192.168.60.1
ip route-static 192.168.40.0 255.255.255.0 192.168.50.1 preference 100
ip route-static 192.168.40.0 255.255.255.0 192.168.60.1
测试:
  display vrrp
  查看mster路由和backup路由

LSW2:
华为VRRP和浮动路由配置与应用_第2张图片

LSW3:
华为VRRP和浮动路由配置与应用_第3张图片