• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

H3C SR6600 SR6600-X系列路由器 典型配置案例集-R8128-6W101

43-H3C SR6600_SR6600-X路由器 VRRP典型配置举例

本章节下载  (562.45 KB)

docurl=/cn/Service/Document_Software/Document_Center/Home/Routers/00-Public/Configure/Typical_Configuration_Example/H3C_SR6600_SR6600-X_CE(V7)-R7607-2683/202208/1674335_30005_0.htm

43-H3C SR6600_SR6600-X路由器 VRRP典型配置举例

H3C SR6600/SR6600-X系列路由器

VRRP配置举例

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Copyright © 2022 新华三技术有限公司 版权所有,保留一切权利。

非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,并不得以任何形式传播。

除新华三技术有限公司的商标外,本手册中出现的其它公司的商标、产品标识及商品名称,由各自权利人拥有。

本文档中的信息可能变动,恕不另行通知。



1  简介

本文档介绍VRRP的配置举例。

2  配置前提

本文档不严格与具体软、硬件版本对应,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。

本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。

本文档假设您已了解VRRP特性。

3  IPv4 VRRP单备份组配置举例

3.1  组网需求

图1所示,Host A所在网络的出口处部署了两台网关设备。现要求使用VRRP主备备份功能,将这两台设备组成一台虚拟路由器,作为Host A的缺省网关。具体应用需求如下:

·     在正常情况下,由Device A承担网关功能,转发Host A发送至外网的流量;

·     当Device A或者Device A的上行接口出现故障时,由Device B接替Device A承担网关功能;

·     当Device A或者Device A的上行接口故障恢复后,由Device A继续承担网关功能。

图1 IPv4 VRRP单备份组配置组网图

 

 

3.2  配置思路

·     为了让Device A成为Master,需要为Device A配置较高的优先级;

·     将VRRP组的抢占模式和监视上行接口状态功能结合使用,可以使Master设备根据上行接口的状态自动调整自身的VRRP优先级,从而使VRRP组内的角色发生转变,实现主备切换;

·     为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间。

3.3  使用版本

本举例是在R8128版本上进行配置和验证的。

3.4  配置注意事项

·     备份组的虚拟IP地址不能为全零地址(0.0.0.0)、广播地址(255.255.255.255)、环回地址、非A/B/C类地址和其它非法IP地址(如0.0.0.1)。

·     IPv4 VRRP既可以使用VRRPv2版本,也可以使用VRRPv3版本(缺省情况使用VRRPv3)。请确保IPv4 VRRP备份组中的所有路由器上配置的IPv4 VRRP版本一致,否则备份组无法正常工作。

·     建议将备份组的虚拟IP地址和备份组中设备下行接口的IP地址配置为同一网段,否则可能导致局域网内的主机无法访问外部网络。

·     删除IP地址拥有者上的VRRP备份组,将导致地址冲突。建议先修改配置了备份组的接口的IP地址,再删除该接口上的VRRP备份组,以避免地址冲突。

·     对于同一个VRRP备份组的成员设备,必须保证虚拟路由器的IP地址配置完全一样。

·     用户在配置降低优先级幅度时,需要确保降低后的优先级比备份组内其他设备的优先级要低,确保备份组内有其他设备被选为Master。

3.5  配置步骤

(1)     Device A的配置

# 配置接口IP地址。

<DeviceA> system-view

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ip address 192.168.0.2 24

# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为192.168.0.1。

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 192.168.0.1

# 设置Device A在VRRP备份组1中的优先级为110,高于Device B的优先级100,以保证Device A成为Master负责转发流量。

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 priority 110

# 设置Device A工作在抢占方式,以保证Device A故障恢复后,能再次抢占成为Master,即只要Device A正常工作,就由Device A负责转发流量。为了避免频繁地进行状态切换,配置抢占延迟时间为5秒。

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 preempt-mode delay 500

[DeviceA-GigabitEthernet1/0/1] quit

# 创建和上行接口GigabitEthernet 1/0/2关联的Track项1。

[DeviceA] track 1 interface gigabitethernet 1/0/2

# 配置监视Track项1,Track项的状态为Negative时,Device A在VRRP备份组中的优先级降低的数值为50。

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 track 1  priority reduced 50

[DeviceA-GigabitEthernet1/0/1] quit

(2)     Device B的配置

# 配置接口IP地址。

<DeviceB> system-view

[DeviceB] interface gigabitEthernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ip address 192.168.0.3 24

# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为192.168.0.1。

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 192.168.0.1

# 设置Device B在VRRP备份组1中的优先级为100。

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 1 priority 100

# 设置Device B工作在抢占方式,抢占延迟时间为5秒。

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 1 preempt-mode delay 500

[DeviceB-GigabitEthernet1/0/1] quit

3.6  验证配置

# 配置完成后,在Host A上可以ping通Host B。

# 通过display vrrp verbose命令查看配置后的结果,显示Device A上VRRP备份组1的详细信息。

[DeviceA] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 110                  Running Pri  : 110

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 192.168.0.1

     Virtual MAC    : 0000-5e00-0101

     Master IP      : 192.168.0.2

   VRRP Track Information:

     Track Object   : 1                   State : Positive   Pri Reduced : 50

# 通过display vrrp verbose命令查看配置后的结果,显示Device B上VRRP备份组1的详细信息。

[DeviceB] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Become Master  : 412ms left

     Auth Type      : None

     Virtual IP     : 192.168.0.1

     Master IP      : 192.168.0.2

以上显示信息表示在VRRP备份组1中Device A为Master路由器,Device B为Backup路由器,Host A发送给Host B的报文通过Device A转发。

# Device A出现故障后,在Host A上仍然可以ping通Host B。

# 通过display vrrp verbose命令查看Device B上VRRP备份组的详细信息,Device A出现故障后,显示Device B上VRRP备份组1的详细信息。

[DeviceB] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 192.168.0.1

     Virtual MAC    : 0000-5e00-0101

     Master IP      : 192.168.0.3

以上显示信息表示Device A出现故障后,Device B成为Master路由器,Host A发送给Host B的报文通过Device B转发。

# Device A故障恢复后,显示Device AVRRP备份组1的详细信息。

[DeviceA] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 110                  Running Pri  : 110

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 192.168.0.1

     Virtual MAC    : 0000-5e00-0101

     Master IP      : 192.168.0.2

   VRRP Track Information:

     Track Object   : 1                   State : Positive   Pri Reduced : 50

以上显示信息表示Device A故障恢复后,Device A会抢占成为MasterHost A发送给Host B的报文仍然通过Device A转发。

3.7  配置文件

·     Device A:

#

interface GigabitEthernet1/0/1

 port link-mode route

 ip address 192.168.0.2 255.255.255.0

 vrrp vrid 1 virtual-ip 192.168.0.1

 vrrp vrid 1 priority 110

 vrrp vrid 1 preempt-mode delay 500

 vrrp vrid 1 track 1 priority reduced 50

#

 track 1 interface gigabitethernet 1/0/2

#

·     Device B:

#

interface GigabitEthernet1/0/1

 port link-mode route

 ip address 192.168.0.3 255.255.255.0

 vrrp vrid 1 virtual-ip 192.168.0.1

 vrrp vrid 1 priority 100

 vrrp vrid 1 preempt-mode delay 500

#

4  IPv4 VRRP多备份组配置举例

4.1  组网需求

图2所示,某公司为了实现网关设备的冗余备份,以及内网主机流量的负载分担,在内部网络的出口处部署了两台设备,并使用VRRP负载分担功能,将这两台设备组成两台虚拟路由器,分别作为区域A和区域B的缺省网关。具体应用需求如下:

·     Device A是VRRP备份组1中的Master设备,Device B是VRRP备份组2中的Master设备。在正常情况下,区域A的用户通过Device A进行数据转发,区域B的用户通过Device B进行数据转发。

·     当Device A或者Device A的上行接口发生故障后,Device B能够迅速承担区域A内主机流量的转发任务;Device A故障恢复后,继续承担VRRP备份组1的网关功能;

·     当Device B或者Device B的上行接口故障发生故障后,Device A能够迅速承担区域B内主机流量的转发任务;Device B故障恢复后,继续承担VRRP备份组2的网关功能。

图2 IPv4 VRRP多备份组配置组网图

 

4.2  配置思路

·     为了让Device A和Device B分别成为VRRP备份组1和VRRP备份组2中的Master,需要在VRRP备份组1中为Device A配置较高的优先级,在VRRP备份组2中为Device B配置较高的优先级。

·     为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间。

4.3  使用版本

本举例是在R8128版本上进行配置和验证的。

4.4  配置注意事项

·     VRRP备份组的虚拟IP地址不能为全零地址(0.0.0.0)、广播地址(255.255.255.255)、环回地址、非A/B/C类地址和其它非法IP地址(如0.0.0.1)。

·     IPv4 VRRP既可以使用VRRPv2版本,也可以使用VRRPv3版本(缺省情况使用VRRPv3)。请确保IPv4 VRRP备份组中的所有路由器上配置的IPv4 VRRP版本一致,否则VRRP备份组无法正常工作。

·     建议将备份组的虚拟IP地址和备份组中设备下行接口的IP地址配置为同一网段,否则可能导致局域网内的主机无法访问外部网络。

·     删除IP地址拥有者上的VRRP备份组,将导致地址冲突。建议先修改配置了VRRP备份组的接口的IP地址,再删除该接口上的VRRP备份组,以避免地址冲突。

·     用户在配置降低优先级幅度时,需要确保降低后的优先级比VRRP备份组内其他设备的优先级要低,确保VRRP备份组内有其他设备被选为Master设备。

·     对于同一个VRRP备份组的成员设备,如下配置必须保证完全一样:

¡     虚拟路由器的IP地址个数

¡     每个备份组虚拟路由器的IP地址

¡     定时器间隔时间

4.5  配置步骤

(1)     Device A的配置

# 配置接口IP地址。

<DeviceA> system-view

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ip address 10.0.0.2 24

# 请参考以上方法配置4.1  图2中其它接口的IP地址,配置步骤这里省略。

# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为10.0.0.1,并配置Device A在VRRP备份组1中的优先级为120,高于Device B的优先级。

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.0.0.1

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 priority 120

[DeviceA-GigabitEthernet1/0/1] quit  

# 创建VRRP备份组2,并配置VRRP备份组2的虚拟IP地址为11.0.0.1。

[DeviceA] interface gigabitethernet 1/0/3

[DeviceA-GigabitEthernet1/0/3] vrrp vrid 2 virtual-ip 11.0.0.1

[DeviceA-GigabitEthernet1/0/3] quit

# 设置Device A工作在抢占方式,配置抢占延迟时间为5秒。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 preempt-mode delay 500

[DeviceA-GigabitEthernet1/0/1] quit

# 创建和上行接口GigabitEthernet 1/0/2关联的Track项1。

[DeviceA] track 1 interface gigabitethernet 1/0/2

# 配置监视Track项1,Track项的状态为Negative时,Device A在VRRP备份组1中的优先级降低的数值为50。

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 track 1 priority  reduced 50

[DeviceA-GigabitEthernet1/0/1] quit

(2)     Device B的配置

<DeviceB> system-view

[DeviceB] interface gigabitEthernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ip address 10.0.0.3 24

# 请参考以上方法配置4.1  图2中其它接口的IP地址,配置步骤省略。

# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为10.0.0.1。

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.0.0.1

[DeviceB-GigabitEthernet1/0/1] quit

# 创建VRRP备份组2,并配置VRRP备份组2的虚拟IP地址为11.0.0.1,并配置Device B在VRRP备份组2中的优先级为120,高于Device A的优先级。

[DeviceB] interface gigabitethernet 1/0/3

[DeviceB-GigabitEthernet1/0/3] vrrp vrid 2 virtual-ip 11.0.0.1

[DeviceB-GigabitEthernet1/0/3] vrrp vrid 2 priority 120

# 设置Device B工作在抢占方式,配置抢占延迟时间为5秒。

[DeviceB-GigabitEthernet1/0/3] vrrp vrid 2 preempt-mode delay 500

[DeviceB-GigabitEthernet1/0/3] quit

# 创建和上行接口GigabitEthernet 1/0/2关联的Track项2。

[DeviceB] track 2 interface gigabitethernet 1/0/2

# 配置监视Track项2,Track项的状态为Negative时,Device B在VRRP备份组2中的优先级降低的数值为50。

[DeviceB] interface gigabitEthernet 1/0/3

[DeviceB-GigabitEthernet1/0/3] vrrp vrid 2 track 2 priority reduced 50

[DeviceB-GigabitEthernet1/0/3] quit

4.6  验证配置

(1)     配置完成后,区域A和区域B中的主机都可以ping通外网。

# 检查区域A的主机到目的端100.0.0.1是否可达。

<host A> ping 100.0.0.1

PING 100.0.0.1 (100.0.0.1): 56 data bytes

56 bytes from 100.0.0.1: seq=0 ttl=128 time=22.43 ms

56 bytes from 100.0.0.1: seq=1 ttl=128 time=7.17 ms

56 bytes from 100.0.0.1: seq=2 ttl=128 time=8.91 ms

56 bytes from 100.0.0.1: seq=3 ttl=128 time=7.45 ms

56 bytes from 100.0.0.1: seq=4 ttl=128 time=9.11 ms

 

--- 100.0.0.1 ping statistics ---

5 packets transmitted, 5 packets received, 0% packet loss

round-trip min/avg/max = 7.17/11.01/22.43 ms

# 检查区域B的主机到目的端100.1.0.1是否可达。

<host C> ping 100.1.0.1

PING 100.1.0.1 (100.1.0.1): 56 data bytes

56 bytes from 100.1.0.1: seq=0 ttl=128 time=22.43 ms

56 bytes from 100.1.0.1: seq=1 ttl=128 time=7.17 ms

56 bytes from 100.1.0.1: seq=2 ttl=128 time=8.91 ms

56 bytes from 100.1.0.1: seq=3 ttl=128 time=7.45 ms

56 bytes from 100.1.0.1: seq=4 ttl=128 time=9.11 ms

 

--- 100.1.0.1 ping statistics ---

5 packets transmitted, 5 packets received, 0% packet loss

round-trip min/avg/max = 7.17/11.01/22.43 ms

(2)     通过display vrrp verbose命令查看配置后的结果。

# 查看Device A上全部IPv4 VRRP备份组的详细信息,显示Device A在VRRP备份组1中为Master设备,在VRRP备份组2中为Backup设备。

[DeviceA] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode       : Standard

 Total number of virtual routers : 2

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 10.0.0.1

     Virtual MAC    : 0000-5e00-0101

     Master IP      : 10.0.0.2

   VRRP Track Information:                                                     

     Track Object   : 1                   State : Positive   Pri Reduced : 50  

 

   Interface GigabitEthernet1/0/3

     VRID           : 2                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 0

     Auth Type      : None

     Become Master  : 3550ms left

     Virtual IP     : 11.0.0.1

     Master IP      : 11.0.0.3

# 查看Device B上全部IPv4 VRRP备份组的详细信息,显示Device B在备份组1中为Backup设备,在备份组2中为Master设备。

[DeviceB] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode       : Standard

 Total number of virtual routers : 2

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 0

     Auth Type      : None

     Become Master  : 3500ms left

     Virtual IP     : 10.0.0.1

     Master IP      : 10.0.0.2

 

   Interface GigabitEthernet1/0/3

     VRID           : 2                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 11.0.0.1

     Virtual MAC    : 0000-5e00-0102

     Master IP      : 11.0.0.3

   VRRP Track Information:                                                     

     Track Object   : 2                   State : Positive   Pri Reduced : 50  

# Device A出现故障后,通过display vrrp verbose命令查看Device B上备份组的详细信息。可以看到Device B抢占为备份组1Master

[DeviceB] display vrrp verbose

IPv4 Virtual Router Information:

 Running  Mode       : Standard

 Total number of virtual routers : 2

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 0

     Auth Type      : None

     Virtual IP     : 10.0.0.1

     Virtual MAC    : 0000-5e00-0101

     Master IP      : 10.0.0.3

 

   Interface GigabitEthernet1/0/3

     VRID           : 2                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 11.0.0.1

     Virtual MAC    : 0000-5e00-0102

     Master IP      : 11.0.0.3

   VRRP Track Information:                                                     

     Track Object   : 2                   State : Positive   Pri Reduced : 50  

以上显示信息表示Device A出现故障后,区域A和区域B中的主机仍然可以ping通外网。

# Device A故障恢复后,显示Device A上备份组的详细信息。

[DeviceA] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 2

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 10.0.0.1

     Virtual MAC    : 0000-5e00-0101

     Master IP      : 10.0.0.2

   VRRP Track Information:                                                     

     Track Object   : 1                   State : Positive   Pri Reduced : 50  

 

   Interface GigabitEthernet1/0/3

     VRID           : 2                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 0

     Become Master  : 3550ms left

     Auth Type      : None

     Virtual IP     : 11.0.0.1

     Master IP      : 11.0.0.3

以上显示信息表示当Device A故障恢复后,Device AVRRP备份组1中恢复为原来的优先级并抢占成为该备份组的Master,区域A内的主机通过Device A与外界通信。

4.7  配置文件

·     Device A:

#

interface GigabitEthernet1/0/1

 port link-mode route

 ip address 10.0.0.2 255.255.255.0

 vrrp vrid 1 virtual-ip 10.0.0.1

 vrrp vrid 1 priority 120

 vrrp vrid 1 preempt-mode delay 500

 vrrp vrid 1 track 1 priority reduced 50

#

interface GigabitEthernet1/0/2

 port link-mode route

 ip address 100.0.0.2 255.255.255.0

 undo stp enable

#

interface GigabitEthernet1/0/3

 port link-mode route

 ip address 11.0.0.2 255.255.255.0

 vrrp vrid 2 virtual-ip 11.0.0.1

#

 track 1 interface gigabitethernet 1/0/2

#

·     Device B:

#

interface GigabitEthernet1/0/1

 port link-mode route

 ip address 10.0.0.3 255.255.255.0

 vrrp vrid 1 virtual-ip 10.0.0.1

#

interface GigabitEthernet1/0/2

 port link-mode route

 ip address 100.1.0.2 255.255.255.0

 undo stp enable

#

interface GigabitEthernet1/0/3

 port link-mode route

 ip address 11.0.0.3 255.255.255.0

 vrrp vrid 2 priority 120

 vrrp vrid 2 preempt-mode delay 500

 vrrp vrid 2 track 2 priority reduced 50

#

 track 2 interface gigabitethernet 1/0/2

#

5  IPv4 VRRP负载均衡模式配置举例

5.1  组网需求

图3所示,Host A、Host B和Host C所在网络的出口处部署了三台设备。现要求使用VRRP负载均衡功能,将Device A、Device B和Device C组成一台虚拟路由器,作为局域网内主机的缺省网关。具体应用需求如下:

·     实现VRRP备份组中三台设备都可以转发报文,实现流量负载分担,充分利用网关资源;

·     当Device A、Device B或Device C自身或其上行接口出现故障时,Host A、Host B和Host C可以通过其他正常运行的设备继续通信,避免通信中断;当Device A、Device B或Device C故障恢复后,继续承担网关功能。

图3 IPv4 VRRP负载均衡模式配置组网图

 

5.2  配置思路

·     为了使Device A优先与Device B和Device C被选举为VRRP备份组的Master设备,需要为其配置高于Device B和Device C的优先级;为了使Device B优先于Device C被选举为VRRP备份组的Master设备,需要为其配置高于Device C的优先级;

·     为了避免由于故障造成VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间;

·     在Device A、Device B和Device C上配置虚拟转发器通过Track项监视上行接口的状态。当上行接口出现故障时,降低该接口所在设备虚拟转发器的权重,以便其他设备接管该设备的转发任务,避免通信中断;

·     为了保证原Master设备故障恢复后,能再次抢占成为Master,需要配置VRRP备份组工作在抢占模式。

5.3  使用版本

本举例是在R8128版本上进行配置和验证的。

5.4  配置注意事项

·     建议将备份组的虚拟IP地址和备份组中设备下行接口的IP地址配置为同一网段,否则可能导致局域网内的主机无法访问外部网络。

·     VRRP备份组的虚拟IP地址不能为全零地址(0.0.0.0)、广播地址(255.255.255.255)、环回地址、非A/B/C类地址和其它非法IP地址(如0.0.0.1)。

·     IPv4 VRRP既可以使用VRRPv2版本,也可以使用VRRPv3版本(缺省情况使用VRRPv3)。请确保IPv4 VRRP备份组中的所有路由器上配置的IPv4 VRRP版本一致,否则VRRP备份组无法正常工作。

·     VRRP工作在负载均衡模式时,备份组的虚拟IP地址和接口的IP地址不能相同,否则VRRP负载均衡功能将无法正常工作。

·     当监视的上行链路出现故障时,配置的权重降低数额需保证VF Owner的权重低于失效下限,即权重降低的数额大于245,其它的虚拟转发器才能接替VF Owner成为AVF。

·     对于同一个VRRP备份组的成员设备,必须保证备份组虚拟路由器的IP地址配置完全一样。

·     用户在配置降低权重幅度时,需要确保降低后的优先级比VRRP备份组内其他设备的优先级要低,确保VRRP备份组内有其他设备被选为Master。

5.5  配置步骤

5.5.1  Device A的配置

(1)     配置接口

# 配置接口。

<DeviceA> system-view

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ip address 10.1.1.2 24

[DeviceA-GigabitEthernet1/0/1] quit

(2)     配置VRRP

# 配置VRRP工作在负载均衡模式。

[DeviceA] vrrp mode load-balance

# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为10.1.1.1。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.1.1.1

# 配置Device A在VRRP备份组1中的优先级为120,高于Device B的优先级110和Device C的优先级100,以保证Device A成为Master。

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 priority 120

# 配置Device A工作在抢占方式,以保证Device A故障恢复后,能再次抢占成为Master,即只要Device A正常工作,Device A就会成为Master。为了避免频繁地进行状态切换,配置抢占延迟时间为5秒。

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 preempt-mode delay 500

[DeviceA-GigabitEthernet1/0/1] quit

(3)     配置Track

# 创建和GigabitEthernet1/0/2关联的Track项1。如果Track项的状态为Negative,则说明Device A的上行接口出现故障。

[DeviceA] track 1 interface gigabitethernet 1/0/2

# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Device A上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Device A的转发任务。本例中,配置虚拟转发器权重降低数额为250。

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] vrrp vrid 1 track 1 weight reduced 250

[DeviceA-GigabitEthernet1/0/1] quit

5.5.2   Device B的配置

(1)     配置接口

# 配置接口。

<DeviceB> system-view

[DeviceB] interface gigabitEthernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ip address 10.1.1.3 24

[DeviceB-GigabitEthernet1/0/1] quit

[DeviceB] interface gigabitEthernet 1/0/2

[DeviceB-GigabitEthernet1/0/2] quit

(2)     配置VRRP

# 配置VRRP工作在负载均衡模式。

[DeviceB] vrrp mode load-balance

# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为10.1.1.1。

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.1.1.1

# 配置Device B在VRRP备份组1中的优先级为110,高于Device C的优先级,以保证Device A出现故障时,Device B成为Master。

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 1 priority 110

# 配置Device B工作在抢占方式,抢占延迟时间为5秒。

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 1 preempt-mode delay 500

[DeviceB-GigabitEthernet1/0/1] quit

(3)     配置Track

# 创建和GigabitEthernet1/0/2关联的Track项1。如果Track项的状态为Negative,则说明Device B的上行接口出现故障。

[DeviceB] track 1 interface gigabitethernet 1/0/2

# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Device B上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Device B的转发任务。本例中,配置虚拟转发器权重降低数额为250。

[DeviceB] interface gigabitEthernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 1 track 1 weight reduced 250

[DeviceB-GigabitEthernet1/0/1] quit

5.5.3  Device C的配置

(1)     配置接口

# 配置接口。

<DeviceC> system-view

[DeviceC] interface gigabitEthernet 1/0/1

[DeviceC-GigabitEthernet1/0/1] ip address 10.1.1.4 24

[DeviceC-GigabitEthernet1/0/1] quit

[DeviceC] interface gigabitEthernet 1/0/2

[DeviceC-GigabitEthernet1/0/2] quit

(2)     配置VRRP

# 配置VRRP工作在负载均衡模式。

[DeviceA] vrrp mode load-balance

# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为10.1.1.1。

[DeviceC] interface gigabitethernet 1/0/1

[DeviceC-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.1.1.1

# 配置Device C工作在抢占方式,抢占延迟时间为5秒。

[DeviceC-GigabitEthernet1/0/1] vrrp vrid 1 preempt-mode delay 500

[DeviceC-GigabitEthernet1/0/1] quit

(3)     配置Track

# 创建和GigabitEthernet1/0/2关联的Track项1。如果Track项的状态为Negative,则说明Device C的上行接口出现故障。

[DeviceC] track 1 interface gigabitethernet 1/0/2

# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Device C上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Device C的转发任务。本例中,配置虚拟转发器权重降低数额为250。

[DeviceC] interface gigabitEthernet 1/0/1

[DeviceC-GigabitEthernet1/0/1] vrrp vrid 1 track 1 weight reduced 250

[DeviceC-GigabitEthernet1/0/1] quit

5.5.4  验证配置

(1)     配置完成后,在Host A上可以ping通外网,通过display vrrp verbose命令查看配置后的结果

# 显示Device A上VRRP备份组的详细信息。

[DeviceA] display vrrp verbose

IPv4 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 10.1.1.1

     Member IP List : 10.1.1.2 (Local, Master)

                      10.1.1.3 (Backup)

                      10.1.1.4 (Backup)

   Forwarder Information: 3 Forwarders 1 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 01

     State          : Active

     Virtual MAC    : 000f-e2ff-0011 (Owner)

     Owner ID       : 0000-5e01-1101

     Priority       : 255

     Active         : local

    Forwarder 02

     State          : Listening

     Virtual MAC    : 000f-e2ff-0012 (Learnt)

     Owner ID       : 0000-5e01-1103

     Priority       : 127

     Active         : 10.1.1.3

    Forwarder 03

     State          : Listening

     Virtual MAC    : 000f-e2ff-0013 (Learnt)

     Owner ID       : 0000-5e01-1105

     Priority       : 127

     Active         : 10.1.1.4

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

# 显示Device B上VRRP备份组的详细信息。

[DeviceB] display vrrp verbose

IPv4 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 110                  Running Pri  : 110

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 10.1.1.1

     Member IP List : 10.1.1.3 (Local, Backup)

                      10.1.1.2 (Master)

                      10.1.1.4 (Backup)

   Forwarder Information: 3 Forwarders 1 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 01

     State          : Listening

     Virtual MAC    : 000f-e2ff-0011 (Learnt)

     Owner ID       : 0000-5e01-1101

     Priority       : 127

     Active         : 10.1.1.2

    Forwarder 02

     State          : Active

     Virtual MAC    : 000f-e2ff-0012 (Owner)

     Owner ID       : 0000-5e01-1103

     Priority       : 255

     Active         : local

    Forwarder 03

     State          : Listening

     Virtual MAC    : 000f-e2ff-0013 (Learnt)

     Owner ID       : 0000-5e01-1105

     Priority       : 127

     Active         : 10.1.1.4

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

# 显示Device C上VRRP备份组的详细信息。

[DeviceC] display vrrp verbose

IPv4 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 10.1.1.1

     Member IP List : 10.1.1.4 (Local, Backup)

                      10.1.1.2 (Master)

                      10.1.1.3 (Backup)

   Forwarder Information: 3 Forwarders 1 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 01

     State          : Listening

     Virtual MAC    : 000f-e2ff-0011 (Learnt)

     Owner ID       : 0000-5e01-1101

     Priority       : 127

     Active         : 10.1.1.2

    Forwarder 02

     State          : Listening

     Virtual MAC    : 000f-e2ff-0012 (Learnt)

     Owner ID       : 0000-5e01-1103

     Priority       : 127

     Active         : 10.1.1.3

    Forwarder 03

     State          : Active

     Virtual MAC    : 000f-e2ff-0013 (Owner)

     Owner ID       : 0000-5e01-1105

     Priority       : 255

     Active         : local

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

以上显示信息表示在VRRP备份组1中Device A为Master,Device B和Device C 为Backup。Device A、Device B和Device C上各自存在一个AVF,并存在作为备份的两个LVF。

(2)     Device A的上行接口(GigabitEthernet1/0/2)出现故障后

# 显示Device A上VRRP备份组的详细信息。

[DeviceA] display vrrp verbose

IPv4 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 10.1.1.1

     Member IP List : 10.1.1.2 (Local, Master)

                      10.1.1.3 (Backup)

                      10.1.1.4 (Backup)

   Forwarder Information: 3 Forwarders 0 Active

     Config Weight  : 255

     Running Weight : 5

    Forwarder 01

     State          : Initialize

     Virtual MAC    : 000f-e2ff-0011 (Owner)

     Owner ID       : 0000-5e01-1101

     Priority       : 0

     Active         : 10.1.1.4

    Forwarder 02

     State          : Initialize

     Virtual MAC    : 000f-e2ff-0012 (Learnt)

     Owner ID       : 0000-5e01-1103

     Priority       : 0

     Active         : 10.1.1.3

    Forwarder 03

     State          : Initialize

     Virtual MAC    : 000f-e2ff-0013 (Learnt)

     Owner ID       : 0000-5e01-1105

     Priority       : 0

     Active         : 10.1.1.4

   Forwarder Weight Track Information:

     Track Object   : 1          State : Negative   Weight Reduced : 250

# 显示Device C上VRRP备份组的详细信息。

[DeviceC] display vrrp verbose

IPv4 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Become Master  : 3550ms left

     Virtual IP     : 10.1.1.1

     Member IP List : 10.1.1.4 (Local, Backup)

                      10.1.1.2 (Master)

                      10.1.1.3 (Backup)

   Forwarder Information: 3 Forwarders 2 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 01

     State          : Active

     Virtual MAC    : 000f-e2ff-0011 (Take Over)

     Owner ID       : 0000-5e01-1101

     Priority       : 85

     Active         : local

     Redirect Time  : 93 secs

     Time-out Time  : 1293 secs

    Forwarder 02

     State          : Listening

     Virtual MAC    : 000f-e2ff-0012 (Learnt)

     Owner ID       : 0000-5e01-1103

     Priority       : 85

     Active         : 10.1.1.3

    Forwarder 03

     State          : Active

     Virtual MAC    : 000f-e2ff-0013 (Owner)

     Owner ID       : 0000-5e01-1105

     Priority       : 255

     Active         : local

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

以上显示信息表示Device A的上行接口出现故障后,Device A上虚拟转发器的权重降低为5,低于失效下限。Device A上所有虚拟转发器的状态均变为Initialized,不能再用于转发。Device C成为虚拟MAC地址000f-e2ff-0011对应虚拟转发器的AVF,接管Device A的转发任务。

# Timeout Timer超时后(约1800秒后),查看Device C上VRRP备份组的详细信息。

[DeviceC] display vrrp verbose

IPv4 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Become Master  : 3550ms left

     Virtual IP     : 10.1.1.1

     Member IP List : 10.1.1.4 (Local, Backup)

                      10.1.1.2 (Master)

                      10.1.1.3 (Backup)

   Forwarder Information: 2 Forwarders 1 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 02

     State          : Listening

     Virtual MAC    : 000f-e2ff-0012 (Learnt)

     Owner ID       : 0000-5e01-1103

     Priority       : 127

     Active         : 10.1.1.3

    Forwarder 03

     State          : Active

     Virtual MAC    : 000f-e2ff-0013 (Owner)

     Owner ID       : 0000-5e01-1105

     Priority       : 255

     Active         : local

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

以上显示信息表示,Timeout Timer超时后,删除虚拟MAC地址000f-e2ff-0011对应的虚拟转发器,不再转发目的MAC地址为该MAC的报文。

(3)     Device A出现故障后

# 显示Device B上VRRP备份组的详细信息。

[DeviceB] display vrrp verbose

 IPv4 Standby Information:

     Run Mode       : Load Balance

     Run Method     : Virtual MAC

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 1

     Admin Status   : Up                   State        : Master

     Config Pri     : 110                  Running Pri  : 110

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : 10.1.1.1

     Member IP List : 10.1.1.3 (Local, Master)

                      10.1.1.4 (Backup)

   Forwarder Information: 2 Forwarders 1 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 02

     State          : Active

     Virtual MAC    : 000f-e2ff-0012 (Owner)

     Owner ID       : 0000-5e01-1103

     Priority       : 255

     Active         : local

    Forwarder 03

     State          : Listening

     Virtual MAC    : 000f-e2ff-0013 (Learnt)

     Owner ID       : 0000-5e01-1105

     Priority       : 127

     Active         : 10.1.1.4

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

以上显示信息表示Device A出现故障后,Device B的优先级高于Device C,将抢占成为Master。

5.5.5  配置文件

·     Device A:

#

 vrrp mode load-balance

#

interface GigabitEthernet1/0/1

 port link-mode route

 ip address 10.1.1.2 255.255.255.0

 vrrp vrid 1 virtual-ip 10.1.1.1

 vrrp vrid 1 priority 120

 vrrp vrid 1 preempt-mode delay 500

 vrrp vrid 1 track 1 weight reduced 250

#

interface GigabitEthernet1/0/2

 port link-mode route

#

track 1 interface GigabitEthernet1/0/2

#

·     Device B:

#

 vrrp mode load-balance

#

interface GigabitEthernet1/0/1

 port link-mode route

 ip address 10.1.1.3 255.255.255.0

 vrrp vrid 1 virtual-ip 10.1.1.1

 vrrp vrid 1 priority 110

 vrrp vrid 1 preempt-mode delay 500

 vrrp vrid 1 track 1 weight reduced 250

#

interface GigabitEthernet1/0/2

 port link-mode route

#

track 1 interface GigabitEthernet1/0/2

#

l     Device C

#

 vrrp mode load-balance

#

interface GigabitEthernet1/0/1

 port link-mode route

 ip address 10.1.1.4 255.255.255.0

 vrrp vrid 1 virtual-ip 10.1.1.1

 vrrp vrid 1 preempt-mode delay 500

 vrrp vrid 1 track 1 weight reduced 250

#

interface GigabitEthernet1/0/2

 port link-mode route

#

track 1 interface GigabitEthernet1/0/2

#

6  IPv4 VRRP with IPsec配置举例

6.1  组网需求

图4所示,Device A作为某公司分支机构的网关设备,Device B 和Device C是公司总部网关设备。Device B 和Device C通过部署VRRP协议,实现设备冗余备份,提高可靠性。该分支机构内的主机可以访问公司总部内部服务器的资源。具体应用需求如下:

·     在正常情况下,Device B作为Master负责流量的转发;

·     当Device B出现故障时,由Device C接替其流量转发任务;

·     要求在Device A和公司总部出口网关之间部署IPsec隧道,以保证分支机构内网网段192.168.1.0/24和总部内网网段20.0.0.0/24之间数据的完整性和机密性。

图4 IPv4 VRRP with IPsec配置组网图

 

6.2  配置思路

·     由于IPsec隧道是点到点建立的,为保护主机与服务器之间数据的安全性,需要Device A与VRRP备份组100中的Master建立IPsec隧道。

·     为了避免VRRP组发生主备切换时造成IPsec隧道的中断,可以通过配置DPD功能保证Device A可以及时的检测到对端路由器的状态,并重新与VRRP备份组中的其他路由器进行IKE协商。

·     为了让Device B成为Master,需要为Device B配置较高的优先级。

·     将VRRP组的抢占模式和监视上行接口状态功能结合使用,可以使Master设备根据连接总部内网接口GigabitEthernet 1/0/2的状态自动调整自身的VRRP优先级,从而使VRRP组内的角色发生转变,实现主备切换。

·     为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间。

6.3  使用版本

本举例是在R8128版本上进行配置和验证的。

6.4  配置注意事项

·     VRRP备份组的虚拟IP地址不能为全零地址(0.0.0.0)、广播地址(255.255.255.255)、环回地址、非A/B/C类地址和其它非法IP地址(如0.0.0.1)。

·     建议将备份组的虚拟IP地址和备份组中设备下行接口的IP地址配置为同一网段,否则可能导致局域网内的主机无法访问外部网络。

·     IPv4 VRRP既可以使用VRRPv2版本,也可以使用VRRPv3版本(缺省情况使用VRRPv3)。请确保IPv4 VRRP备份组中的所有路由器上配置的IPv4 VRRP版本一致,否则VRRP备份组无法正常工作。

·     删除IP地址拥有者上的VRRP备份组,将导致地址冲突。建议先修改配置了VRRP备份组的接口的IP地址,再删除该接口上的VRRP备份组,以避免地址冲突。

·     IPsec隧道两端配置的ACL的源地址和目的地址必须对称。

·     IKE协商双方配置的预共享密钥必须相同。

·     对于同一个VRRP备份组的成员设备,必须保证备份组虚拟路由器的IP地址完全一样。

·     用户在配置降低优先级幅度时,需要确保降低后的优先级比VRRP备份组内其他设备的优先级要低,确保VRRP备份组内有其他设备被选为Master。

6.5  配置步骤

6.5.1  Device A的配置

# 配置接口的IP地址。

<DeviceA> system-view

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ip address 192.168.1.1 255.255.255.0

[DeviceA-GigabitEthernet1/0/1] quit

[DeviceA] interface gigabitethernet 1/0/2

[DeviceA-GigabitEthernet1/0/2] ip address 10.0.0.100 255.255.255.0

[DeviceA-GigabitEthernet1/0/2] quit

# 配置到20.0.0.0/24网段的静态路由。

[DeviceA] ip route-static 20.0.0.0 255.255.255.0 10.0.0.1

# 配置ACL 3000,指定IPsec需要保护的数据流。

[DeviceA] acl advanced 3000

[DeviceA-acl-ipv4-adv-3000] rule 0 permit ip source 192.168.1.0 0.0.0.255 destination 20.0.0.0 0.0.0.255

[DeviceA-acl-ipv4-adv-3000] quit

# 配置流量触发IKE DPD探测间隔时间为10秒,重传时间间隔为5秒,探测模式为按需探测。

[DeviceA] ike dpd interval 10 retry 5 on-demand

# 创建IKE Keychain,并配置与对端地址为虚拟IP地址10.0.0.1使用的预共享密钥为明文的123456。

[DeviceA] ike keychain test

[DeviceA-ike-keychain-test] pre-shared-key address 10.0.0.1 key simple 123456

[DeviceA-ike-keychain-test] quit

# 创建IKE profile,指定采用预共享密钥时使用的IKE Keychain,并配置使用IP地址10.0.0.100标识本端身份信息、使用VRRP备份组100的虚拟IP地址10.0.0.1来匹配对端身份。

[DeviceA] ike profile test

[DeviceA-ike-profile-test] keychain test

[DeviceA-ike-profile-test] local-identity address 10.0.0.100

[DeviceA-ike-profile-test] match remote identity address 10.0.0.1 24

[DeviceA-ike-profile-test] quit

# 创建IPsec安全提议test,安全封装模式、安全协议类型均采用系统缺省值。

[DeviceA] ipsec transform-set test

# 配置ESP协议采用的加密算法为采用64比特的DES算法,认证算法为MD5。

[DeviceA-ipsec-transform-set-test] esp encryption-algorithm des-cbc

[DeviceA-ipsec-transform-set-test] esp authentication-algorithm md5

[DeviceA-ipsec-transform-set-test] quit

# 创建IPsec安全策略test、顺序号为1、采用IKE方式协商IPsec SA的IPsec安全策略,并进入IPsec安全策略视图。

[DeviceA] ipsec policy test 1 isakmp

# 指定IPsec隧道的对端IP地址为10.0.0.1。

[DeviceA-ipsec-policy-isakmp-test-1] remote-address 10.0.0.1

# 配置IPsec安全策略引用ACL 3000。

[DeviceA-ipsec-policy-isakmp-test-1] security acl 3000

# 配置IPsec安全策略引用安全提议test。

[DeviceA-ipsec-policy-isakmp-test-1] transform-set test

# 配置IPsec安全策略引用名为test的IKE profile。

[DeviceA-ipsec-policy-isakmp-test-1] ike-profile test

[DeviceA-ipsec-policy-isakmp-test-1] quit

# 应用IPsec策略。

[DeviceA] interface gigabitethernet 1/0/2

[DeviceA-GigabitEthernet1/0/2] ipsec apply policy test

[DeviceA-GigabitEthernet1/0/2] quit

6.5.2  Device B的配置

# 配置接口的IP地址。

<DeviceB> system-view

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ip address 10.0.0.2 255.255.255.0

[DeviceB-GigabitEthernet1/0/1] quit

[DeviceB] interface gigabitethernet 1/0/2

[DeviceB-GigabitEthernet1/0/2] ip address 20.0.0.2 255.255.255.0

[DeviceB-GigabitEthernet1/0/2] quit

# 配置到192.168.1.0/24网段的静态路由。

[DeviceB] ip route-static 192.168.1.0 255.255.255.0 10.0.0.100

# 配置ACL 3000,指定IPsec需要保护的数据流。

[DeviceB] acl advanced 3000

[DeviceB-acl-ipv4-adv-3000] rule 0 permit ip source 20.0.0.0 0.0.0.255 destination 192.168.0.0 0.0.0.255

[DeviceB-acl-ipv4-adv-3000] quit

# 创建IKE Keychain,并配置与对端地址为10.0.0.100使用的预共享密钥为明文的123456。

[DeviceB] ike keychain test

[DeviceB-ike-keychain-test] pre-shared-key address 10.0.0.100 key simple 123456

[DeviceB-ike-keychain-test] quit

# 创建IKE profile,指定采用预共享密钥时使用的IKE Keychain,并配置使用VRRP备份组100的虚拟IP地址10.0.0.1标识本端身份信息、使用DeviceA的上行接口地址10.0.0.100来匹配对端身份。

[DeviceB] ike profile test

[DeviceB-ike-profile-test] keychain test

[DeviceB-ike-profile-test] local-identity address 10.0.0.1

[DeviceB-ike-profile-test] match remote identity address 10.0.0.100 24

[DeviceB-ike-profile-test] quit

# 创建IPsec安全提议test,安全封装模式、安全协议类型均采用系统缺省值。

[DeviceB] ipsec transform-set test

# 配置ESP协议采用的加密算法为采用64比特的DES算法,认证算法为MD5。

[DeviceB-ipsec-transform-set-test] esp encryption-algorithm des-cbc

[DeviceB-ipsec-transform-set-test] esp authentication-algorithm md5

[DeviceB-ipsec-transform-set-test] quit

# 创建IPsec安全策略test、顺序号为1、采用IKE方式协商IPsec SA的IPsec安全策略,并进入IPsec安全策略视图。

[DeviceB] ipsec policy test 1 isakmp

# 指定IPsec隧道的对端IP地址为10.0.0.100。

[DeviceB-ipsec-policy-isakmp-test-1] remote-address 10.0.0.100

# 配置IPsec安全策略引用ACL 3000。

[DeviceB-ipsec-policy-isakmp-test-1] security acl 3000

# 配置IPsec安全策略引用安全提议test。

[DeviceB-ipsec-policy-isakmp-test-1] transform-set test

# 配置IPsec安全策略引用名为test的IKE profile。

[DeviceB-ipsec-policy-isakmp-test-1] ike-profile test

[DeviceB-ipsec-policy-isakmp-test-1] quit

# 应用IPsec策略。

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ipsec apply policy test

[DeviceB-GigabitEthernet1/0/1] quit

# 创建Track项1,监视GigabitEthernet1/0/2接口状态。

[DeviceB] track 1 interface gigabitethernet 1/0/2

# 创建VRRP备份组100,配置虚拟IP地址为10.0.0.1。

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 100 virtual-ip 10.0.0.1

# 设备在VRRP备份组中的优先级默认为100,因此配置Device B在VRRP备份组100中的优先级为150。

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 100 priority 150

# 配置监视指定的Track项1,当Track项1的状态为Negative时,Device B在备份组100中的优先级降低60,使其低于默认值。

[DeviceB-GigabitEthernet1/0/1] vrrp vrid 100 track 1 priority reduce 60

[DeviceB-GigabitEthernet1/0/1] quit

# 创建Track项2,监视GigabitEthernet1/0/1接口状态。

[DeviceB] track 2 interface gigabitethernet 1/0/1

# 创建VRRP备份组200,配置虚拟IP地址为20.0.0.1。

[DeviceB] interface gigabitethernet 1/0/2

[DeviceB-GigabitEthernet1/0/2] vrrp vrid 200 virtual-ip 20.0.0.1

# 设备在VRRP备份组中的优先级默认为100,因此配置Device B在VRRP备份组200中的优先级为150。

[DeviceB-GigabitEthernet1/0/2] vrrp vrid 200 priority 150

# 配置监视指定的Track项2,当Track项2的状态为Negative时,Device B在备份组200中的优先级降低60,使其低于默认值。

[DeviceB-GigabitEthernet1/0/2] vrrp vrid 200 track 2 priority reduce 60

[DeviceB-GigabitEthernet1/0/2] quit

6.5.3  Device C的配置

# 配置接口的IP地址。

<DeviceC> system-view

[DeviceC] interface gigabitethernet 1/0/1

[DeviceC-GigabitEthernet1/0/1] ip address 10.0.0.3 255.255.255.0

[DeviceC-GigabitEthernet1/0/1] quit

[DeviceC] interface gigabitethernet 1/0/2

[DeviceC-GigabitEthernet1/0/2] ip address 20.0.0.3 255.255.255.0

[DeviceC-GigabitEthernet1/0/2] quit

# 配置到192.168.1.0/24网段的静态路由。

[DeviceC] ip route-static 192.168.1.0 255.255.255.0 10.0.0.100

# 配置ACL 3000,指定IPsec需要保护的数据流。

[DeviceC] acl advanced 3000

[DeviceC-acl-ipv4-adv-3000] rule 0 permit ip source 20.0.0.0 0.0.0.255 destination 192.168.0.0 0.0.0.255

[DeviceC-acl-ipv4-adv-3000] quit

# 创建IKE Keychain,并配置与对端地址为10.0.0.100使用的预共享密钥为明文的123456

[DeviceC] ike keychain test

[DeviceC-ike-keychain-test] pre-shared-key address 10.0.0.100 key simple 123456

[DeviceC-ike-keychain-test] quit

# 创建IKE profile,指定采用预共享密钥时使用的IKE Keychain,并配置使用VRRP备份组100的虚拟IP地址10.0.0.1标识本端身份信息、使用Device A的上行接口地址10.0.0.100来匹配对端身份。

[DeviceC] ike profile test

[DeviceC-ike-profile-test] keychain test

[DeviceC-ike-profile-test] local-identity address 10.0.0.1

[DeviceC-ike-profile-test] match remote identity address 10.0.0.100 24

[DeviceC-ike-profile-test] quit

# 创建IPsec安全提议test,安全封装模式、安全协议类型均采用系统缺省值。

[DeviceC] ipsec transform-set test

# 配置ESP协议采用的加密算法为采用64比特的DES算法,认证算法为MD5。

[DeviceC-ipsec-transform-set-test] esp encryption-algorithm des-cbc

[DeviceC-ipsec-transform-set-test] esp authentication-algorithm md5

[DeviceC-ipsec-transform-set-test] quit

# 创建IPsec安全策略test、顺序号为1、采用IKE方式协商IPsec SA的IPsec安全策略,并进入IPsec安全策略视图。

[DeviceC] ipsec policy test 1 isakmp

# 指定IPsec隧道的对端IP地址为10.0.0.100。

[DeviceC-ipsec-policy-isakmp-test-1] remote-address 10.0.0.100

# 配置IPsec安全策略引用ACL 3000。

[DeviceC-ipsec-policy-isakmp-test-1] security acl 3000

# 配置IPsec安全策略引用安全提议test。

[DeviceC-ipsec-policy-isakmp-test-1] transform-set test

# 配置IPsec安全策略引用名为test的IKE profile。

[DeviceC-ipsec-policy-isakmp-test-1] ike-profile test

[DeviceC-ipsec-policy-isakmp-test-1] quit

# 应用IPsec策略。

[DeviceC] interface gigabitethernet 1/0/1

[DeviceC-GigabitEthernet1/0/1] ipsec apply policy test

[DeviceC-GigabitEthernet1/0/1] quit

# 创建VRRP备份组100,配置虚拟IP地址为10.0.0.1。

[DeviceC] interface gigabitethernet 1/0/1

[DeviceC-GigabitEthernet1/0/1] vrrp vrid 100 virtual-ip 10.0.0.1

[DeviceC-GigabitEthernet1/0/1] quit

# 创建VRRP备份组200,配置虚拟IP地址为20.0.0.1。

[DeviceC] interface gigabitethernet 1/0/2

[DeviceC-GigabitEthernet1/0/2] vrrp vrid 200 virtual-ip 20.0.0.1

[DeviceC-GigabitEthernet1/0/2] quit

6.6  验证配置

(1)     在Device B和Device C上分别查看VRRP备份组的信息。可以看到在VRRP备份组100和VRRP备份组200中,Master均为Device B,Backup均为Device C。

# 在Device B上查看VRRP备份组信息。

[DeviceB] display vrrp verbose

 IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 2

   Interface GigabitEthernet1/0/1

     VRID           : 100                 Adver Timer  : 100

     Admin Status   : Up                  State        : Master

     Config Pri     : 150                 Running Pri  : 150

     Preempt Mode   : Yes                 Delay Time   : 0

     Auth Type      : None

     Virtual IP     : 10.0.0.1

     Virtual MAC    : 0000-5e00-0164

     Master IP      : 10.0.0.2 

   VRRP Track Information:

     Track Object   : 1                   State : Positive   Pri Reduced : 60

 

   Interface GigabitEthernet1/0/2

     VRID           : 200                 Adver Timer  : 100

     Admin Status   : Up                  State        : Master

     Config Pri     : 150                 Running Pri  : 150

     Preempt Mode   : Yes                 Delay Time   : 0

     Auth Type      : None

     Virtual IP     : 20.0.0.1

     Virtual MAC    : 0000-5e00-0102

     Master IP      : 20.0.0.2

   VRRP Track Information:

     Track Object   : 2                   State : Positive   Pri Reduced : 60

# 在Device C上查看VRRP备份组信息。

[DeviceC] display vrrp verbose

 IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 2

   Interface GigabitEthernet1/0/1

     VRID           : 100                 Adver Timer  : 100

     Admin Status   : Up                  State        : Backup

     Config Pri     : 100                 Running Pri  : 100

     Preempt Mode   : Yes                 Delay Time   : 0

     Become Master  : 3480ms left

     Auth Type      : None

     Virtual IP     : 10.0.0.1

     Master IP      : 10.0.0.2 

 

   Interface GigabitEthernet1/0/2

     VRID           : 200                 Adver Timer  : 100

     Admin Status   : Up                  State        : Backup

     Config Pri     : 100                 Running Pri  : 100

     Preempt Mode   : Yes                 Delay Time   : 0

     Become Master  : 2820ms left

     Auth Type      : None

     Virtual IP     : 20.0.0.1

     Master IP      : 20.0.0.2

(2)     从分支机构ping总部网关的IP地址20.0.0.1,触发IKE协商,SA协商成功后可以ping通。

<DeviceA> ping -a 192.168.1.1 20.0.0.1

  PING 30.1.1.123: 56  data bytes, press CTRL_C to break

    Request time out

    Reply from 20.0.0.1: bytes=56 Sequence=1 ttl=127 time=2 ms

    Reply from 20.0.0.1: bytes=56 Sequence=2 ttl=127 time=1 ms

    Reply from 20.0.0.1: bytes=56 Sequence=3 ttl=127 time=1 ms

    Reply from 20.0.0.1: bytes=56 Sequence=4 ttl=127 time=2 ms

 

  --- 20.0.0.1 ping statistics ---

    5 packet(s) transmitted

    4 packet(s) received

    20.00% packet loss

    round-trip min/avg/max = 1/1/2 ms

(3)     通过diplay ike sa命令分别在Device A和Device B上查看到IKE SA的建立情况。

# 在Device A上查看IKE SA的信息,可以看到Device A的IKE SA对端地址为VRRP备份组的虚拟IP地址。

[DeviceA] display ike sa

    Connection-ID   Remote                Flag         DOI

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

    29              10.0.0.1              RD           IPSEC

Flags:

RD--READY RL--REPLACED FD-FADING

# 在Device B上查看IKE SA的信息,可以看到Device B的IKE SA对端地址为Device A上GigabitEthernet1/0/2接口的IP地址。

[DeviceB] display ike sa

    Connection-ID   Remote                Flag         DOI

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

    17              10.0.0.100            RD           IPSEC

Flags:

RD--READY RL--REPLACED FD-FADING

(4)     通过display ipsec sa brief命令分别在Device A和Device B上查看到IPsec SA的建立情况,可以看到IPsec隧道已成功建立

# 在Device A上查看IPsec SA的信息。

[DeviceA] display ipsec sa brief

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

Interface/Global    Dst Address       SPI         Protocol    Status

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

GE1/0/2             10.0.0.1          4051765865  ESP         active

GE1/0/2             10.0.0.100        1860835944  ESP         active

# 在Device B上查看IPsec SA的信息。

[DeviceB] display ipsec sa brief

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

Interface/Global    Dst Address       SPI         Protocol    Status

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

GE1/0/1             10.0.0.100        1860835944  ESP         active

GE1/0/1             10.0.0.1          4051765865  ESP         active

(5)     手工关闭Device B的GigabitEthernet1/0/1接口,Device B的VRRP状态切换到Backup,Device C的VRRP状态切换到Master。重新从分支机构ping总部的IP地址20.0.0.1,DPD检测IKE对等体无响应,删除本端SA,重新与Device C进行IKE协商,建立新的SA后,可以ping通总部IP地址。

# 在Device B上查看当前VRRP的状态信息。

[DeviceB] display vrrp

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 2

 Interface          VRID   State       Run     Adver   Auth     Virtual

                                       Pri     Timer   Type        IP

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

 GE1/0/1            100    Initialize  150     1       None     10.0.0.1

 GE1/0/2            200    Backup      90      1       None     20.0.0.1

# 在Device C上查看当前VRRP的状态信息,已经从Backup状态切换成Master状态。

[DeviceC] display vrrp

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 2

 Interface          VRID   State       Run     Adver   Auth     Virtual

                                       Pri     Timer   Type        IP

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

 GE1/0/1            100    Master      100     1       None     10.0.0.1

 GE1/0/2            200    Master      100     1       None     20.0.0.1

# 从Device A上ping总部网关IP地址20.0.0.1,可以ping通。

<DeviceA> ping -a 192.168.1.1 20.0.0.1

  PING 20.0.0.1: 56  data bytes, press CTRL_C to break

    Reply from 20.0.0.1: bytes=56 Sequence=0 ttl=127 time=2 ms

    Reply from 20.0.0.1: bytes=56 Sequence=1 ttl=127 time=1 ms

    Reply from 20.0.0.1: bytes=56 Sequence=2 ttl=127 time=1 ms

    Reply from 20.0.0.1: bytes=56 Sequence=3 ttl=127 time=1 ms

    Reply from 20.0.0.1: bytes=56 Sequence=4 ttl=127 time=2 ms

 

  --- 20.0.0.1 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 1/1/2 ms

# 通过display ike sa命令中的标识符connection-id字段,可以判断Device A上已经重新协商了SA。

[DeviceA] display ike sa

    Connection-ID   Remote                Flag         DOI

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

    30              10.0.0.1              RD           IPSEC

 

  flag meaning

  RD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO--TIMEOUT RK--REKEY

# 在Device C上可以查看到SA信息。

[DeviceC] display ike sa

    Connection-ID   Remote                Flag         DOI

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

    3               10.0.0.100            RD           IPSEC

 

  flag meaning

  RD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO--TIMEOUT RK--REKEY

[DeviceC] display ipsec sa brief

 total phase-2 IPv4 SAs: 2

Interface/Global    Dst Address       SPI         Protocol    Status

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

GE1/0/1             10.0.0.100        1235764751  ESP         active

GE1/0/1             10.0.0.1          799485439   ESP         active

(6)     当Device B的GE1/0/1接口重新UP时,VRRP状态切换为Master,从分支到总部的数据流会重新发送到Device B上,通过DPD特性,Device A删除SA重新与Device B进行IKE协商,协商成功后分支到总部的数据流会在新的IPsec隧道上得以传输。验证方法与上一个步骤相同,此处省略。

6.7  配置文件

·     Device A:

#

interface GigabitEthernet1/0/1

 port link-mode route

 ip address 192.168.1.1 255.255.255.0

#

interface GigabitEthernet1/0/2

 port link-mode route

 ip address 10.0.0.100 255.255.255.0

 ipsec apply policy test

#

ip route-static 20.0.0.0 255.255.255.0 10.0.0.1

#

acl advanced 3000

 rule 0 permit ip source 192.168.1.0 0.0.0.255 destination 20.0.0.0 0.0.0.255

#

ipsec transform-set test

 esp encryption-algorithm des-cbc

 esp authentication-algorithm md5

#

ipsec policy test 1 isakmp

 transform-set test

 security acl 3000

 remote-address 10.0.0.1

 ike-profile test

#

 ike dpd interval 10 on-demand

#

ike profile test

 keychain test

 local-identity address 10.0.0.100

 match remote identity address 10.0.0.1 255.255.255.0

#

ike keychain test

 pre-shared-key address 10.0.0.1 255.255.255.255 key cipher $c$3$VPq7TeKUusm/5GG8rHfZGHQR+Rbrhbk=

#

·     Device B:

#

interface GigabitEthernet1/0/1

 port link-mode route

 ip address 10.0.0.2 255.255.255.0

 vrrp vrid 100 virtual-ip 10.0.0.1

 vrrp vrid 100 priority 150

 vrrp vrid 100 track 1 priority reduce 60

#

interface GigabitEthernet1/0/2

 port link-mode route

 ip address 20.0.0.2 255.255.255.0

 vrrp vrid 200 virtual-ip 20.0.0.1

 vrrp vrid 200 priority 150

 vrrp vrid 200 track 2 priority reduce 60

 ipsec apply policy test

#

 ip route-static 192.168.1.0 255.255.255.0 10.0.0.100

#

acl advanced 3000

 rule 0 permit ip source 20.0.0.0 0.0.0.255 destination 192.168.1.0 0.0.0.255

#

ipsec transform-set test

 esp encryption-algorithm des-cbc

 esp authentication-algorithm md5

#

ipsec policy test 1 isakmp

 transform-set test

 security acl 3000

 remote-address 10.0.0.100

 ike-profile test

#

ike profile test

 keychain test

 local-identity address 10.0.0.1

 match remote identity address 10.0.0.100 255.255.255.0

#

ike keychain test

 pre-shared-key address 10.0.0.100 255.255.255.255 key cipher $c$3$VPq7TeKUusm/5GG8rHfZGHQR+Rbrhbk=

#

 track 1 interface gigabitethernet 1/0/2

#

·     Device C:

#

interface GigabitEthernet1/0/1

 port link-mode route

 ip address 10.0.0.3 255.255.255.0

#

interface GigabitEthernet1/0/2

 port link-mode route

 ip address 20.0.0.3 255.255.255.0

 ipsec apply policy test

#

ip route-static 192.168.1.0 255.255.255.0 10.0.0.100

#

acl advanced 3000

 rule 0 permit ip source 20.0.0.0 0.0.0.255 destination 192.168.1.0 0.0.0.255

#

ipsec transform-set test

 esp encryption-algorithm des-cbc

 esp authentication-algorithm md5

#

ipsec policy test 1 isakmp

 transform-set test

 security acl 3000

 remote-address 10.0.0.100

 ike-profile test

#

ike profile test

 keychain test

 local-identity address 10.0.0.1

 match remote identity address 10.0.0.100 255.255.255.0

#

ike keychain test

 pre-shared-key address 10.0.0.100 255.255.255.255 key cipher $c$3$VPq7TeKUusm/5GG8rHfZGHQR+Rbrhbk=

#

7  IPv6 VRRP单备份组配置举例

7.1  组网需求

图5所示,Area A区域的用户(Host A和Host B)所在网络的出口处部署了两台网关设备。现要求使用VRRP主备备份功能,将这两台设备组成一台虚拟路由器,作为Area A区域用户的缺省网关。具体应用需求如下:

·     在正常情况下,由Device A承担网关功能,转发Area A区域用户发送至外网的流量;

·     当Device A或者Device A的上行接口出现故障时,由Device B接替Device A承担网关功能;

·     当Device A或者Device A的上行接口故障恢复后,由Device A继续承担网关功能。

图5 IPv6 VRRP单备份组配置组网图

 

 

7.2  配置思路

·     为了让Device A成为Master,需要为Device A配置较高的优先级;

·     将VRRP组的抢占模式和监视上行接口状态功能结合使用,可以使Master设备根据上行接口的状态自动调整自身的VRRP优先级,从而使VRRP组内的角色发生转变,实现主备切换;

·     为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间。

7.3  使用版本

本举例是在R8128版本上进行配置和验证的。

7.4  配置注意事项

·     建议将备份组的虚拟IPv6地址和备份组中设备下行接口的IPv6地址配置为同一网段,否则可能导致局域网内的主机无法访问外部网络。

·     IPv6 VRRP既可以使用VRRPv2版本,也可以使用VRRPv3版本(缺省情况使用VRRPv3)。请确保IPv6 VRRP备份组中的所有路由器上配置的IPv6 VRRP版本一致,否则备份组无法正常工作。

·     删除IP地址拥有者上的VRRP备份组,将导致地址冲突。建议先修改配置了备份组的接口的IP地址,再删除该接口上的VRRP备份组,以避免地址冲突。

·     对于同一个VRRP备份组的成员设备,必须保证虚拟路由器的IP地址配置完全一样。

·     用户在配置降低优先级幅度时,需要确保降低后的优先级比备份组内其他设备的优先级要低,确保备份组内有其他设备被选为Master。

7.5  配置步骤

(1)     Device A的配置

# 配置接口IPv6地址。

<DeviceA> system-view

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ipv6 address fe80::1 link-local

[DeviceA-GigabitEthernet1/0/1] ipv6 address 1::1 64

# 创建VRRP备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和1::10。

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip 1::10

# 配置允许发布RA消息,以便Area A的主机通过RA消息学习到缺省网关地址。

[DeviceA-GigabitEthernet1/0/1] undo ipv6 nd ra halt

# 设置Device A在VRRP备份组1中的优先级为110,高于Device B的优先级100,以保证Device A成为Master负责转发流量。

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 priority 110

# 设置Device A工作在抢占方式,以保证Device A故障恢复后,能再次抢占成为Master,即只要Device A正常工作,就由Device A负责转发流量。为了避免频繁地进行状态切换,配置抢占延迟时间为5秒。

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 preempt-mode delay 500

[DeviceA-GigabitEthernet1/0/1] quit

# 创建和上行接口GigabitEthernet 1/0/3关联的Track项1。

[DeviceA] track 1 interface gigabitethernet 1/0/3

# 配置监视Track项1,Track项的状态为Negative时,Device A在VRRP备份组中的优先级降低的数值为50。

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 track 1 priority reduced 50

[DeviceA-GigabitEthernet1/0/1] quit

(2)     Device B的配置

# 配置接口IP地址。

<DeviceB> system-view

[DeviceB] interface gigabitEthernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ipv6 address fe80::2 link-local

[DeviceB-GigabitEthernet1/0/1] ipv6 address 1::2 64

# 创建VRRP备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和1::10。

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip 1::10

# 配置允许发布RA消息,以便Area A的主机通过RA消息学习到缺省网关地址。

[DeviceB-GigabitEthernet1/0/1] undo ipv6 nd ra halt

# 设置Device B工作在抢占方式,抢占延迟时间为5秒。

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 preempt-mode delay 500

[DeviceB-GigabitEthernet1/0/1] quit

7.6  验证配置

# 配置完成后,Area A里面的主机可以ping通外网。如Host A可以ping通IPv6地址为30::1的主机。

Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

 

C:\Users\hostA>ping 30::1

 

Pinging 30::1 with 32 bytes of data:

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

 

Ping statistics for 30::1:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 0ms, Average = 0ms

# 通过display vrrp ipv6 verbose命令查看配置后的结果,显示Device A上IPv6 VRRP备份组1的详细信息。

[DeviceA] display vrrp ipv6 verbose

IPv6 Virtual Router Information:

 Running mode      : Standard

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                   Adver Timer  : 100

     Admin Status   : Up                  State        : Master

     Config Pri     : 110                 Running Pri  : 110

     Preempt Mode   : Yes                 Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::10

                      1::10

     Virtual MAC    : 0000-5e00-0201

     Master IP      : FE80::1

   VRRP Track Information:

     Track Object   : 1                   State : Positive   Pri Reduced : 50

# 通过display vrrp ipv6 verbose命令查看配置后的结果,显示Device B上IPv6 VRRP备份组1的详细信息。

[DeviceB] display vrrp ipv6 verbose

IPv6 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                   Adver Timer  : 100

     Admin Status   : Up                  State        : Backup

     Config Pri     : 100                 Running Pri  : 100

     Preempt Mode   : Yes                 Delay Time   : 500

     Become Master  : 3000ms left

     Auth Type      : None

     Virtual IP     : FE80::10

                      1::10

     Master IP      : FE80::1

以上显示信息表示在IPv6 VRRP备份组1中Device A为Master路由器,Device B为Backup路由器,Area A的用户发送给外网的报文通过Device A转发。

# Device A或Device A的上行接口出现故障后,Area A的用户上仍然可以与外网通信。

Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

 

C:\Users\hostA>ping 30::1

 

Pinging 30::1 with 32 bytes of data:

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

 

Ping statistics for 30::1:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 0ms, Average = 0ms

# 通过display vrrp ipv6 verbose命令查看Device B上IPv6 VRRP备份组的详细信息,Device A或Device A的上行接口出现故障后,显示Device B上IPv6 VRRP备份组1的详细信息。

[DeviceB] display vrrp ipv6 verbose

IPv6 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                   Adver Timer  : 100

     Admin Status   : Up                  State        : Master

     Config Pri     : 100                 Running Pri  : 100

     Preempt Mode   : Yes                 Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::10

                      1::10

     Virtual MAC    : 0000-5e00-0201

     Master IP      : FE80::2

以上显示信息表示Device A或Device A的上行接口出现故障后,Device B成为Master路由器,Area A的用户发送给外网的报文通过Device B转发。

# Device ADevice A的上行接口故障恢复后,显示Device AVRRP备份组1的详细信息。

[DeviceA] display vrrp ipv6 verbose

IPv6 Virtual Router Information:

 Running mode      : Standard

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                   Adver Timer  : 100

     Admin Status   : Up                  State        : Master

     Config Pri     : 110                 Running Pri  : 110

     Preempt Mode   : Yes                 Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::10

                      1::10

     Virtual MAC    : 0000-5e00-0201

     Master IP      : FE80::1

   VRRP Track Information:

     Track Object   : 1                   State : Positive   Pri Reduced : 50

以上显示信息表示Device A故障恢复后,Device A会抢占成为Master,Area A的用户发送给外网的报文仍然通过Device A转发。

7.7  配置文件

·     Device A:

#

 sysname DeviceA

#

interface GigabitEthernet1/0/1

 port link-mode route

ipv6 address fe80::1 link-local

ipv6 address 1::1/64

 undo ipv6 nd ra halt

 vrrp ipv6 vrid 1 virtual-ip FE80::10 link-local

 vrrp ipv6 vrid 1 virtual-ip 1::10

 vrrp ipv6 vrid 1 priority 110

 vrrp ipv6 vrid 1 preempt-mode delay 500

 vrrp ipv6 vrid 1 track 1 priority reduced 50

#

track 1 interface GigabitEthernet1/0/3

#

·     Device B:

#

 sysname DeviceB

#

interface GigabitEthernet1/0/1

 port link-mode route

ipv6 address fe80::2 link-local

ipv6 address 1::2/64

 undo ipv6 nd ra halt

 vrrp ipv6 vrid 1 virtual-ip FE80::10 link-local

 vrrp ipv6 vrid 1 virtual-ip 1::10

 vrrp ipv6 vrid 1 preempt-mode delay 500

#

8  IPv6 VRRP多备份组配置举例

8.1  组网需求

图6所示,某公司为了实现网关设备的冗余备份,以及内网主机流量的负载分担,在内部网络的出口处部署了两台设备,并使用VRRP负载分担功能,将这两台设备组成两台虚拟路由器,分别作为区域A和区域B的缺省网关。具体应用需求如下:

·     Device A是VRRP备份组1中的Master设备,Device B是VRRP备份组2中的Master设备。在正常情况下,区域A的用户通过Device A进行数据转发,区域B的用户通过Device B进行数据转发。

·     当Device A或者Device A的上行接口发生故障后,Device B能够迅速承担区域A内主机流量的转发任务;Device A故障恢复后,继续承担VRRP备份组1的网关功能;

·     当Device B或者Device B的上行接口故障发生故障后,Device A能够迅速承担区域B内主机流量的转发任务;Device B故障恢复后,继续承担VRRP备份组2的网关功能。

图6 IPv6 VRRP多备份组配置组网图

 

8.2  配置思路

·     为了让Device A和Device B分别成为VRRP备份组1和VRRP备份组2中的Master,需要在VRRP备份组1中为Device A配置较高的优先级,在VRRP备份组2中为Device B配置较高的优先级。

·     为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间。

·     将VRRP组的抢占模式和监视上行接口状态功能结合使用,可以使Master设备根据上行接口的状态自动调整自身的VRRP优先级,从而使VRRP组内的角色发生转变,实现主备切换;

8.3  使用版本

本举例是在R8128版本上进行配置和验证的。

8.4  配置注意事项

·     建议将备份组的虚拟IPv6地址和备份组中设备下行接口的IPv6地址配置为同一网段,否则可能导致局域网内的主机无法访问外部网络。

·     IPv6 VRRP既可以使用VRRPv2版本,也可以使用VRRPv3版本(缺省情况使用VRRPv3)。请确保IPv6 VRRP备份组中的所有路由器上配置的IPv6 VRRP版本一致,否则VRRP备份组无法正常工作。

·     删除IP地址拥有者上的VRRP备份组,将导致地址冲突。建议先修改配置了VRRP备份组的接口的IPv6地址,再删除该接口上的VRRP备份组,以避免地址冲突。

·     用户在配置降低优先级幅度时,需要确保降低后的优先级比VRRP备份组内其他设备的优先级要低,确保VRRP备份组内有其他设备被选为Master设备。

·     对于同一个VRRP备份组的成员设备,如下配置必须保证完全一样:

¡     虚拟路由器的IP地址个数

¡     每个备份组虚拟路由器的IP地址

¡     定时器间隔时间

8.5  配置步骤

(1)     Device A的配置

# 配置接口IPv6地址。

<DeviceA> system-view

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ipv6 address fe80::1 link-local

[DeviceA-GigabitEthernet1/0/1] ipv6 address 10::2 64

# 请参考以上方法配置8.1  图6中其它接口的IPv6地址,配置步骤这里省略。

# 创建VRRP备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和10::1,配置抢占延迟时间为5秒,并配置Device A在VRRP备份组1中的优先级为120,高于Device B的优先级。

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip 10::1

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 preempt-mode delay 500

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 priority 120

# 配置允许发布RA消息,以便Area A内主机通过RA消息学习到缺省网关地址。

[DeviceA-GigabitEthernet1/0/1] undo ipv6 nd ra halt

[DeviceA-GigabitEthernet1/0/1] quit

# 创建VRRP备份组2,并配置备份组2的虚拟IPv6地址为FE80::20和11::1,配置抢占延迟时间为5秒。

[DeviceA] interface gigabitethernet 1/0/3

[DeviceA-GigabitEthernet1/0/3] vrrp ipv6 vrid 2 virtual-ip fe80::20 link-local

[DeviceA-GigabitEthernet1/0/3] vrrp ipv6 vrid 2 virtual-ip 11::1

[DeviceA-GigabitEthernet1/0/3] vrrp ipv6 vrid 2 preempt-mode delay 500

# 配置允许发布RA消息,以便Area B内主机通过RA消息学习到缺省网关地址。

[DeviceA-GigabitEthernet1/0/3] undo ipv6 nd ra halt

[DeviceA-GigabitEthernet1/0/3] quit

# 创建和上行接口GigabitEthernet 1/0/2关联的Track项1。

[DeviceA] track 1 interface gigabitethernet 1/0/2

# 配置监视Track项1,Track项的状态为Negative时,Device A在VRRP备份组1中的优先级降低的数值为50。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 track 1 priority reduced 50

[DeviceA-GigabitEthernet1/0/1] quit

(2)     Device B的配置

<DeviceB> system-view

[DeviceB] interface gigabitEthernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ipv6 address fe80::2 link-local

[DeviceB-GigabitEthernet1/0/1] ipv6 address 10::3 64

# 请参考以上方法配置8.1  图6中其它接口的IP地址,配置步骤省略。

# 创建VRRP备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和10::1。

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip 10::1

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 preempt-mode delay 500

# 配置允许发布RA消息,以便Area A内主机通过RA消息学习到缺省网关地址。

[DeviceB-GigabitEthernet1/0/1] undo ipv6 nd ra halt

[DeviceB-GigabitEthernet1/0/1] quit

# 创建VRRP备份组2,并配置备份组1的虚拟IPv6地址为FE80::20和11::1,并配置Device B在VRRP备份组2中的优先级为120,高于Device A的优先级。

[DeviceB] interface gigabitethernet 1/0/3

[DeviceB-GigabitEthernet1/0/3] vrrp ipv6 vrid 2 virtual-ip fe80::20 link-local

[DeviceB-GigabitEthernet1/0/3] vrrp ipv6 vrid 2 virtual-ip 11::1

[DeviceB-GigabitEthernet1/0/3] vrrp ipv6 vrid 2 priority 120

[DeviceA-GigabitEthernet1/0/3] vrrp ipv6 vrid 2 preempt-mode delay 500

# 配置允许发布RA消息,以便Area B内主机通过RA消息学习到缺省网关地址。

[DeviceB-GigabitEthernet1/0/3] undo ipv6 nd ra halt

[DeviceB-GigabitEthernet1/0/3] quit

# 创建和上行接口GigabitEthernet 1/0/2关联的Track项2。

[DeviceB] track 2 interface gigabitethernet 1/0/2

# 配置监视Track项2,Track项的状态为Negative时,Device B在VRRP备份组2中的优先级降低的数值为50。

[DeviceB] interface gigabitEthernet 1/0/3

[DeviceB-GigabitEthernet1/0/3] vrrp ipv6 vrid 2 track 2 priority reduced 50

[DeviceB-GigabitEthernet1/0/3] quit

8.6  验证配置

(1)     配置完成后,区域A和区域B中的主机都可以ping通外网。

# 检查区域A到外网IPv6地址为30::1的主机是否可达。

Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

 

C:\Users\areaA>ping 30::1

 

Pinging 30::1 with 32 bytes of data:

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

 

Ping statistics for 30::1:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 0ms, Average = 0ms

# 检查区域B到外网IPv6地址为30::1的主机是否可达。

Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

 

C:\Users\areaB>ping 30::1

 

Pinging 30::1 with 32 bytes of data:

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

Reply from 30::1: time<1ms

 

Ping statistics for 30::1:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 0ms, Average = 0ms

(2)     通过display vrrp ipv6 verbose命令查看配置后的结果。

# 查看Device A上全部IPv6 VRRP备份组的详细信息,显示Device A在VRRP备份组1中为Master设备,在VRRP备份组2中为Backup设备。

[DeviceA] display vrrp ipv6 verbose

IPv6 Virtual Router Information:

 Running Mode       : Standard

 Total number of virtual routers : 2

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::10

10::1

     Virtual MAC    : 0000-5e00-0201

     Master IP      : FE80::1

   VRRP Track Information:

     Track Object   : 1                   State : Positive   Pri Reduced : 50

 

   Interface GigabitEthernet1/0/3

     VRID           : 2                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Become Master  : 3550ms left

     Virtual IP     : FE80::20

                      11::1

     Master IP      : FE80::4

# 查看Device B上全部IPv6 VRRP备份组的详细信息,显示Device B在备份组1中为Backup设备,在备份组2中为Master设备。

[DeviceB] display vrrp ipv6 verbose

IPv6 Virtual Router Information:

 Running Mode       : Standard

 Total number of virtual routers : 2

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Become Master  : 3500ms left

     Virtual IP     : FE80::10

10::2

     Master IP      : FE80::1

 

   Interface GigabitEthernet1/0/3

     VRID           : 2                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::20

  11::1

     Virtual MAC    : 0000-5e00-0202

     Master IP      : FE80::4

   VRRP Track Information:

     Track Object   : 2                   State : Positive   Pri Reduced : 50

# Device A或Device A的上行接口出现故障后,通过display vrrp ipv6 verbose命令查看Device B上备份组的详细信息。可以看到Device B抢占为备份组1Master

[DeviceB] display vrrp ipv6 verbose

IPv6 Virtual Router Information:

 Running  Mode       : Standard

 Total number of virtual routers : 2

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::10

10::2

     Virtual MAC    : 0000-5e00-0101

     Master IP      : FE80::2

 

  Interface GigabitEthernet1/0/3

     VRID           : 2                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::20

  11::1

     Virtual MAC    : 0000-5e00-0202

     Master IP      : FE80::4

   VRRP Track Information:

     Track Object   : 2                   State : Positive   Pri Reduced : 50

以上显示信息表示Device A或Device A的上行接口出现故障后,Device B设备抢占成为Master,负责转发用户的业务数据。

# Device A或Device A的上行接口故障恢复后,显示Device A上备份组的详细信息。

[DeviceA] display vrrp ipv6 verbose

IPv6 Virtual Router Information:

 Running Mode       : Standard

 Total number of virtual routers : 2

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::10

10::1

     Virtual MAC    : 0000-5e00-0201

     Master IP      : FE80::1

   VRRP Track Information:

     Track Object   : 1                   State : Positive   Pri Reduced : 50

 

   Interface GigabitEthernet1/0/3

     VRID           : 2                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Become Master  : 3550ms left

     Virtual IP     : FE80::20

                      11::1

     Master IP      : FE80::4

以上显示信息表示当Device ADevice A的上行接口故障恢复后,Device AVRRP备份组1中恢复为原来的优先级并抢占成为该备份组的Master,区域A内的主机通过Device A与外界通信。

8.7  配置文件

·     Device A:

#

interface GigabitEthernet1/0/1

 port link-mode route

 ipv6 address fe80::1 link-local

ipv6 address 10::2/64

undo ipv6 nd ra halt

 vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

 vrrp ipv6 vrid 1 virtual-ip 10::1

 vrrp ipv6 vrid 1 priority 120

 vrrp ipv6 vrid 1 preempt-mode delay 500

 vrrp ipv6 vrid 1 track 1 priority reduced 50

#

interface GigabitEthernet1/0/2

 port link-mode route

ipv6 address 3::101/64

#

interface GigabitEthernet1/0/3

 port link-mode route

 ipv6 address fe80::3 link-local

ipv6 address 11::2/64

undo ipv6 nd ra halt

vrrp ipv6 vrid 2 virtual-ip fe80::20 link-local

 vrrp ipv6 vrid 2 virtual-ip 11::1

vrrp ipv6 vrid 2 preempt-mode delay 500

#

 track 1 interface gigabitethernet 1/0/2

#

·     Device B:

#

interface GigabitEthernet1/0/1

 port link-mode route

ipv6 address fe80::2 link-local

ipv6 address 10::3/64

undo ipv6 nd ra halt

 vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

 vrrp ipv6 vrid 1 virtual-ip 10::1

vrrp ipv6 vrid 1 preempt-mode delay 500

 

#

interface GigabitEthernet1/0/2

 port link-mode route

 ipv6 address 4::101/64

#

interface GigabitEthernet1/0/3

 port link-mode route

 ipv6 address fe80::4 link-local

ipv6 address 11::3/64

undo ipv6 nd ra halt

vrrp ipv6 vrid 2 virtual-ip fe80::20 link-local

 vrrp ipv6 vrid 2 virtual-ip 11::1

vrrp ipv6 vrid 2 priority 120

vrrp ipv6 vrid 2 preempt-mode delay 500

vrrp ipv6 vrid 2 track 2 priority reduced 50

#

 track 2 interface gigabitethernet 1/0/2

#

9  IPv6 VRRP负载均衡模式配置举例

9.1  组网需求

图7所示,Host A、Host B和Host C所在网络的出口处部署了三台设备。现要求使用VRRP负载均衡功能,将Device A、Device B和Device C组成一台虚拟路由器,作为局域网内主机的缺省网关。具体应用需求如下:

·     实现VRRP备份组中三台设备都可以转发报文,实现流量负载分担,充分利用网关资源;

·     当Device A、Device B或Device C自身或其上行接口出现故障时,Host A、Host B和Host C可以通过其他正常运行的设备继续通信,避免通信中断;当Device A、Device B或Device C故障恢复后,继续承担网关功能。

图7 IPv6 VRRP负载均衡模式配置组网图

 

9.2  配置思路

·     为了使Device A优先与Device B和Device C被选举为VRRP备份组的Master设备,需要为其配置高于Device B和Device C的优先级;为了使Device B优先于Device C被选举为VRRP备份组的Master设备,需要为其配置高于Device C的优先级;

·     为了避免由于故障造成VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间;

·     在Device A、Device B和Device C上配置虚拟转发器通过Track项监视上行接口的状态。当上行接口出现故障时,降低该接口所在设备虚拟转发器的权重,以便其他设备接管该设备的转发任务,避免通信中断;

·     为了保证原Master设备故障恢复后,能再次抢占成为Master,需要配置VRRP备份组工作在抢占模式。

9.3  使用版本

本举例是在R8128版本上进行配置和验证的。

9.4  配置注意事项

·     建议将备份组的虚拟IPv6地址和备份组中设备下行接口的IPv6地址配置为同一网段,否则可能导致局域网内的主机无法访问外部网络。

·     IPv6 VRRP既可以使用VRRPv2版本,也可以使用VRRPv3版本(缺省情况使用VRRPv3)。请确保IPv6 VRRP备份组中的所有路由器上配置的IPv6 VRRP版本一致,否则VRRP备份组无法正常工作。

·     VRRP工作在负载均衡模式时,备份组的虚拟IPv6地址和接口的IPv6地址不能相同,否则VRRP负载均衡功能将无法正常工作。

·     当监视的上行链路出现故障时,配置的权重降低数额需保证VF Owner的权重低于失效下限,即权重降低的数额大于245,其它的虚拟转发器才能接替VF Owner成为AVF。

·     对于同一个VRRP备份组的成员设备,必须保证备份组虚拟路由器的IPv6地址配置完全一样。

·     用户在配置降低权重幅度时,需要确保降低后的优先级比VRRP备份组内其他设备的优先级要低,确保VRRP备份组内有其他设备被选为Master。

9.5  配置步骤

9.5.1  Device A的配置

(1)     配置接口

# 配置接口IPv6地址。

<DeviceA> system-view

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ip address ipv6 address fe80::1 link-local

[DeviceA-GigabitEthernet1/0/1] ipv6 address 1::1 64

[DeviceA-GigabitEthernet1/0/1] quit

(2)     配置VRRP

# 配置VRRP工作在负载均衡模式。

[DeviceA] vrrp ipv6 mode load-balance

# 创建VRRP备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和1::10。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip 1::10

# 配置Device A在VRRP备份组1中的优先级为120,高于Device B的优先级110和Device C的优先级100,以保证Device A成为Master。

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 priority 120

# 配置Device A工作在抢占方式,配置抢占延迟时间为5秒。

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 preempt-mode delay 500

# 配置允许发布RA消息,以便1::/64网段内主机通过RA消息学习到缺省网关地址。

[DeviceA-GigabitEthernet1/0/1] undo ipv6 nd ra halt

[DeviceA-GigabitEthernet1/0/1] quit

(3)     配置Track

# 创建和GigabitEthernet1/0/2关联的Track项1。如果Track项的状态为Negative,则说明Device A的上行接口出现故障。

[DeviceA] track 1 interface gigabitethernet 1/0/2

# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Device A上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Device A的转发任务。本例中,配置虚拟转发器权重降低数额为250。

[DeviceA] interface gigabitEthernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 track 1 weight reduced 250

[DeviceA-GigabitEthernet1/0/1] quit

9.5.2   Device B的配置

(1)     配置接口

# 配置接口IPv6地址。

<DeviceB> system-view

[DeviceB] interface gigabitEthernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ip address ipv6 address fe80::2 link-local

[DeviceB-GigabitEthernet1/0/1] ipv6 address 1::2 64

[DeviceB-GigabitEthernet1/0/1] quit

(2)     配置VRRP

# 配置VRRP工作在负载均衡模式。

[DeviceB] vrrp ipv6 mode load-balance

# 创建VRRP备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和1::10。

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip 1::10

# 配置Device B的优先级110,高于Device C的优先级100,以保证Device A出现故障时,Device B成为Master。

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 priority 110

# 配置Device B工作在抢占方式,配置抢占延迟时间为5秒。

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 preempt-mode delay 500

# 配置允许发布RA消息,以便1::/64网段内主机通过RA消息学习到缺省网关地址。

[DeviceB-GigabitEthernet1/0/1] undo ipv6 nd ra halt

[DeviceB-GigabitEthernet1/0/1] quit

(3)     配置Track

# 创建和GigabitEthernet1/0/2关联的Track项1。如果Track项的状态为Negative,则说明Device B的上行接口出现故障。

[DeviceB] track 1 interface gigabitethernet 1/0/2

# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Device B上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Device B的转发任务。本例中,配置虚拟转发器权重降低数额为250。

[DeviceB] interface gigabitEthernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 track 1 weight reduced 250

[DeviceB-GigabitEthernet1/0/1] quit

9.5.3  Device C的配置

(1)     配置接口

# 配置接口IPv6地址。

<DeviceC> system-view

[DeviceC] interface gigabitEthernet 1/0/1

[DeviceC-GigabitEthernet1/0/1] ip address ipv6 address fe80::3 link-local

[DeviceC-GigabitEthernet1/0/1] ipv6 address 1::3 64

[DeviceC-GigabitEthernet1/0/1] quit

(2)     配置VRRP

# 配置VRRP工作在负载均衡模式。

[DeviceC] vrrp ipv6 mode load-balance

# 创建VRRP备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和1::10。

[DeviceC] interface gigabitethernet 1/0/1

[DeviceC-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

[DeviceC-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 virtual-ip 1::10

# 配置Device C工作在抢占方式,配置抢占延迟时间为5秒。

[DeviceC-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 preempt-mode delay 500

# 配置允许发布RA消息,以便1::/64网段内主机通过RA消息学习到缺省网关地址。

[DeviceC-GigabitEthernet1/0/1] undo ipv6 nd ra halt

[DeviceC-GigabitEthernet1/0/1] quit

(3)     配置Track

# 创建和GigabitEthernet1/0/2关联的Track项1。如果Track项的状态为Negative,则说明Device C的上行接口出现故障。

[DeviceC] track 1 interface gigabitethernet 1/0/2

# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Device C上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Device C的转发任务。本例中,配置虚拟转发器权重降低数额为250。

[DeviceC] interface gigabitEthernet 1/0/1

[DeviceC-GigabitEthernet1/0/1] vrrp ipv6 vrid 1 track 1 weight reduced 250

[DeviceC-GigabitEthernet1/0/1] quit

9.5.4  验证配置

(1)     配置完成后,在Host A上可以ping通外网,通过display vrrp ipv6 verbose命令查看配置后的结果

# 显示Device A上VRRP备份组的详细信息。

[DeviceA] display vrrp ipv6 verbose

IPv6 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::10

1::10

     Member IP List : FE80::1 (Local, Master)

                      FE80::2 (Backup)

                      FE80::3 (Backup)

   Forwarder Information: 3 Forwarders 1 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 01

     State          : Active

     Virtual MAC    : 000f-e2ff-0011 (Owner)

     Owner ID       : 0000-5e01-1101

     Priority       : 255

     Active         : local

    Forwarder 02

     State          : Listening

     Virtual MAC    : 000f-e2ff-0012 (Learnt)

     Owner ID       : 0000-5e01-1103

     Priority       : 127

     Active         : FE80::2

    Forwarder 03

     State          : Listening

     Virtual MAC    : 000f-e2ff-0013 (Learnt)

     Owner ID       : 0000-5e01-1105

     Priority       : 127

     Active         : FE80::3

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

# 显示Device B上VRRP备份组的详细信息。

[DeviceB] display vrrp ipv6 verbose

IPv6 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 110                  Running Pri  : 110

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::10

1::10

     Member IP List : FE80::2 (Local, Backup)

                      FE80::1 (Master)

                      FE80::3 (Backup)

   Forwarder Information: 3 Forwarders 1 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 01

     State          : Listening

     Virtual MAC    : 000f-e2ff-0011 (Learnt)

     Owner ID       : 0000-5e01-1101

     Priority       : 127

     Active         : FE80::1

    Forwarder 02

     State          : Active

     Virtual MAC    : 000f-e2ff-0012 (Owner)

     Owner ID       : 0000-5e01-1103

     Priority       : 255

     Active         : local

    Forwarder 03

     State          : Listening

     Virtual MAC    : 000f-e2ff-0013 (Learnt)

     Owner ID       : 0000-5e01-1105

     Priority       : 127

     Active         : FE80::3

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

# 显示Device C上VRRP备份组的详细信息。

[DeviceC] display vrrp ipv6 verbose

IPv4 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

   Virtual IP     : FE80::10

1::10

     Member IP List : FE80::3 (Local, Backup)

                      FE80::1 (Master)

                      FE80::2 (Backup)

   Forwarder Information: 3 Forwarders 1 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 01

     State          : Listening

     Virtual MAC    : 000f-e2ff-0011 (Learnt)

     Owner ID       : 0000-5e01-1101

     Priority       : 127

     Active         : FE80::1

    Forwarder 02

     State          : Listening

     Virtual MAC    : 000f-e2ff-0012 (Learnt)

     Owner ID       : 0000-5e01-1103

     Priority       : 127

     Active         : FE80::2

    Forwarder 03

     State          : Active

     Virtual MAC    : 000f-e2ff-0013 (Owner)

     Owner ID       : 0000-5e01-1105

     Priority       : 255

     Active         : local

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

以上显示信息表示在VRRP备份组1中Device A为Master,Device B和Device C 为Backup。Device A、Device B和Device C上各自存在一个AVF,并存在作为备份的两个LVF。

(2)     Device A的上行接口(GigabitEthernet1/0/2)出现故障后

# 显示Device A上VRRP备份组的详细信息。

[DeviceA] display vrrp ipv6 verbose

IPv6 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Master

     Config Pri     : 120                  Running Pri  : 120

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::10

                      1::10

     Member IP List : FE80::1 (Local, Master)

                      FE80::2 (Backup)

                      FE80::3 (Backup)

   Forwarder Information: 3 Forwarders 0 Active

     Config Weight  : 255

     Running Weight : 5

    Forwarder 01

     State          : Initialize

     Virtual MAC    : 000f-e2ff-0011 (Owner)

     Owner ID       : 0000-5e01-1101

     Priority       : 0

     Active         : FE80::3

    Forwarder 02

     State          : Initialize

     Virtual MAC    : 000f-e2ff-0012 (Learnt)

     Owner ID       : 0000-5e01-1103

     Priority       : 0

     Active         : FE80::2

    Forwarder 03

     State          : Initialize

     Virtual MAC    : 000f-e2ff-0013 (Learnt)

     Owner ID       : 0000-5e01-1105

     Priority       : 0

     Active         : FE80::3

   Forwarder Weight Track Information:

     Track Object   : 1          State : Negative   Weight Reduced : 250

# 显示Device C上VRRP备份组的详细信息。

[DeviceC] display vrrp ipv6 verbose

IPv6 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Become Master  : 3550ms left

      Virtual IP     : FE80::10

                       1::10

     Member IP List : FE80::3 (Local, Backup)

                      FE80::1 (Master)

                      FE80::2 (Backup)

   Forwarder Information: 3 Forwarders 2 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 01

     State          : Active

     Virtual MAC    : 000f-e2ff-0011 (Take Over)

     Owner ID       : 0000-5e01-1101

     Priority       : 85

     Active         : local

     Redirect Time  : 93 secs

     Time-out Time  : 1293 secs

    Forwarder 02

     State          : Listening

     Virtual MAC    : 000f-e2ff-0012 (Learnt)

     Owner ID       : 0000-5e01-1103

     Priority       : 85

     Active         : FE80::2

    Forwarder 03

     State          : Active

     Virtual MAC    : 000f-e2ff-0013 (Owner)

     Owner ID       : 0000-5e01-1105

     Priority       : 255

     Active         : local

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

以上显示信息表示Device A的上行接口出现故障后,Device A上虚拟转发器的权重降低为5,低于失效下限。Device A上所有虚拟转发器的状态均变为Initialized,不能再用于转发。Device C成为虚拟MAC地址000f-e2ff-0011对应虚拟转发器的AVF,接管Device A的转发任务。

# Timeout Timer超时后(约1800秒后),查看Device C上VRRP备份组的详细信息。

[DeviceC] display vrrp ipv6 verbose

IPv6 Virtual Device Information:

 Running Mode      : Load Balance

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 100

     Admin Status   : Up                   State        : Backup

     Config Pri     : 100                  Running Pri  : 100

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Become Master  : 3550ms left

     Virtual IP     : FE80::10

                      1::10

     Member IP List : FE80::3 (Local, Backup)

                      FE80::1 (Master)

                      FE80::2 (Backup)

   Forwarder Information: 2 Forwarders 1 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 02

     State          : Listening

     Virtual MAC    : 000f-e2ff-0012 (Learnt)

     Owner ID       : 0000-5e01-1103

     Priority       : 127

     Active         : FE80::2

    Forwarder 03

     State          : Active

     Virtual MAC    : 000f-e2ff-0013 (Owner)

     Owner ID       : 0000-5e01-1105

     Priority       : 255

     Active         : local

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

以上显示信息表示,Timeout Timer超时后,删除虚拟MAC地址000f-e2ff-0011对应的虚拟转发器,不再转发目的MAC地址为该MAC的报文。

(3)     Device A出现故障后

# 显示Device B上VRRP备份组的详细信息。

[DeviceB] display vrrp ipv6 verbose

 IPv6 Standby Information:

     Run Mode       : Load Balance

     Run Method     : Virtual MAC

 Total number of virtual routers : 1

   Interface GigabitEthernet1/0/1

     VRID           : 1                    Adver Timer  : 1

     Admin Status   : Up                   State        : Master

     Config Pri     : 110                  Running Pri  : 110

     Preempt Mode   : Yes                  Delay Time   : 500

     Auth Type      : None

     Virtual IP     : FE80::10

                      1::10

     Member IP List : FE80::2 (Local, Master)

                      FE80::3 (Backup)

   Forwarder Information: 2 Forwarders 1 Active

     Config Weight  : 255

     Running Weight : 255

    Forwarder 02

     State          : Active

     Virtual MAC    : 000f-e2ff-0012 (Owner)

     Owner ID       : 0000-5e01-1103

     Priority       : 255

     Active         : local

    Forwarder 03

     State          : Listening

     Virtual MAC    : 000f-e2ff-0013 (Learnt)

     Owner ID       : 0000-5e01-1105

     Priority       : 127

     Active         : FE80::3

   Forwarder Weight Track Information:

     Track Object   : 1          State : Positive   Weight Reduced : 250

以上显示信息表示Device A出现故障后,Device B的优先级高于Device C,将抢占成为Master。

9.5.5  配置文件

·     Device A:

#

 vrrp ipv6 mode load-balance

#

interface GigabitEthernet1/0/1

 port link-mode route

 ipv6 address fe80::1 link-local

 ipv6 address 1::1 64

undo ipv6 nd ra halt

 vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

vrrp ipv6 vrid 1 virtual-ip 1::10

 vrrp ipv6 vrid 1 priority 120

vrrp ipv6 vrid 1 preempt-mode delay 500

 vrrp ipv6 vrid 1 track 1 weight reduced 250

#

interface GigabitEthernet1/0/2

 port link-mode route

#

track 1 interface GigabitEthernet1/0/2

#

·     Device B:

#

 vrrp ipv6 mode load-balance

#

interface GigabitEthernet1/0/1

 port link-mode route

ipv6 address fe80::2 link-local

 ipv6 address 1::2 64

undo ipv6 nd ra halt

 vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

vrrp ipv6 vrid 1 virtual-ip 1::10

 vrrp ipv6 vrid 1 priority 110

vrrp ipv6 vrid 1 preempt-mode delay 500

 vrrp ipv6 vrid 1 track 1 weight reduced 250

#

interface GigabitEthernet1/0/2

 port link-mode route

#

track 1 interface GigabitEthernet1/0/2

#

l     Device C:

#

 vrrp ipv6 mode load-balance

#

interface GigabitEthernet1/0/1

ipv6 address fe80::3 link-local

 ipv6 address 1::3 64

undo ipv6 nd ra halt

 vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local

vrrp ipv6 vrid 1 virtual-ip 1::10

vrrp ipv6 vrid 1 preempt-mode delay 500

 vrrp ipv6 vrid 1 track 1 weight reduced 250

#

interface GigabitEthernet1/0/2

 port link-mode route

#

track 1 interface GigabitEthernet1/0/2

#

10  相关资料

·     H3C SR6600 SR6600-X 路由器 可靠性配置指导-R7607

·     H3C SR6600 SR6600-X 路由器 可靠性命令参考-R7607

·     H3C SR6600 SR6600-X 路由器 二层技术-以太网交换配置指导-R7607

·     H3C SR6600 SR6600-X 路由器 二层技术-以太网交换命令参考-R7607

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们