55-H3C MSR系列路由器 VRRP典型配置举例
本章节下载: 55-H3C MSR系列路由器 VRRP典型配置举例 (468.66 KB)
H3C MSR系列路由器
VRRP配置举例
Copyright © 2024新华三技术有限公司 版权所有,保留一切权利。
非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,并不得以任何形式传播。
除新华三技术有限公司的商标外,本手册中出现的其它公司的商标、产品标识及商品名称,由各自权利人拥有。
本文档中的信息可能变动,恕不另行通知。
目 录
本文档介绍VRRP的配置举例。
本文档适用于使用Comware V7软件版本的MSR系列路由器,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文档假设您已了解VRRP、STP和IPsec特性。
如图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 VRRP单备份组配置组网图
· 为了让Device A成为Master,需要为Device A配置较高的优先级;
· 将VRRP组的抢占模式和监视上行接口状态功能结合使用,可以使Master设备根据上行接口的状态自动调整自身的VRRP优先级,从而使VRRP组内的角色发生转变,实现主备切换;
· 为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间。
本配置举例是在MSR3610-X1路由器Release 6749版本上进行配置和验证的。
· 备份组的虚拟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地址拥有者上的VRRP备份组,将导致地址冲突。建议先修改配置了备份组的接口的IP地址,再删除该接口上的VRRP备份组,以避免地址冲突。
· 对于同一个VRRP备份组的成员设备,必须保证虚拟路由器的IP地址配置完全一样。
· 用户在配置降低优先级幅度时,需要确保降低后的优先级比备份组内其他设备的优先级要低,确保备份组内有其他设备被选为Master。
# 配置接口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 5
[DeviceA-GigabitEthernet1/0/1] quit
# 创建和上行接口GigabitEthernet1/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
# 配置接口IP地址。
[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 5
[DeviceB-GigabitEthernet1/0/1] quit
# 配置完成后,在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 : 5
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 : 5
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 : 5
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 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 : 5
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会抢占成为Master,Host A发送给Host B的报文仍然通过Device A转发。
· 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 5
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 5
#
如图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 VRRP多备份组配置组网图
· 为了让Device A和Device B分别成为VRRP备份组1和VRRP备份组2中的Master,需要在VRRP备份组1中为Device A配置较高的优先级,在VRRP备份组2中为Device B配置较高的优先级。
· 为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间。
本举例是在R6728版本上进行配置和验证的。
· 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地址拥有者上的VRRP备份组,将导致地址冲突。建议先修改配置了VRRP备份组的接口的IP地址,再删除该接口上的VRRP备份组,以避免地址冲突。
· 用户在配置降低优先级幅度时,需要确保降低后的优先级比VRRP备份组内其他设备的优先级要低,确保VRRP备份组内有其他设备被选为Master设备。
· 对于同一个VRRP备份组的成员设备,如下配置必须保证完全一样:
¡ 虚拟路由器的IP地址个数
¡ 每个备份组虚拟路由器的IP地址
¡ 定时器间隔时间
# 配置接口IP地址。
<DeviceA> system-view
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] ip address 10.0.0.2 24
[DeviceA-GigabitEthernet1/0/1] quit
# 请参考以上方法配置图2中其它接口的IP地址,配置步骤这里省略。
# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为10.0.0.1,并配置Device A在VRRP备份组1中的优先级为120,高于Device B的优先级。
[DeviceA] interface gigabitethernet 1/0/1
[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 5
[DeviceA-GigabitEthernet1/0/1] quit
# 创建和上行接口GigabitEthernet1/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
<DeviceB> system-view
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] ip address 10.0.0.3 24
[DeviceB-GigabitEthernet1/0/1] quit
# 请参考以上方法配置图2中其它接口的IP地址,配置步骤省略。
# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为10.0.0.1。
[DeviceB] interface gigabitethernet 1/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 5
[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
(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 : 5
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 : 5
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抢占为备份组1的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 : 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 : 5
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 : 5
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 A在VRRP备份组1中恢复为原来的优先级并抢占成为该备份组的Master,区域A内的主机通过Device A与外界通信。
· 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 5
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
#
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
#
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 5
vrrp vrid 2 track 2 priority reduced 50
#
track 2 interface Gigabitethernet 1/0/2
#
如图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 VRRP负载均衡模式配置组网图
· 为了使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备份组工作在抢占模式。
本举例是在R6728版本上进行配置和验证的。
· 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地址拥有者上的VRRP备份组,将导致地址冲突。建议先修改配置了VRRP备份组的接口的IP地址,再删除该接口上的VRRP备份组,以避免地址冲突。
· VRRP工作在负载均衡模式时,备份组的虚拟IP地址和接口的IP地址不能相同,否则VRRP负载均衡功能将无法正常工作。
· 当监视的上行链路出现故障时,配置的权重降低数额需保证VF Owner的权重低于失效下限,即权重降低的数额大于245,其它的虚拟转发器才能接替VF Owner成为AVF。
· 对于同一个VRRP备份组的成员设备,必须保证备份组虚拟路由器的IP地址配置完全一样。
· 用户在配置降低权重幅度时,需要确保降低后的优先级比VRRP备份组内其他设备的优先级要低,确保VRRP备份组内有其他设备被选为Master。
(1) 配置接口
# 配置接口的IP地址。
<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 5
[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
(1) 配置接口
# 配置接口的IP地址。
<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
(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 5
[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
(1) 配置接口
# 配置接口的IP地址。
<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
(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 5
[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
(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 : 5
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 : 5
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 : 5
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 : 5
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 : 5
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 : 5
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 : 5
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。
#
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 5
vrrp vrid 1 track 1 weight reduced 250
#
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 5
vrrp vrid 1 track 1 weight reduced 250
#
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 5
vrrp vrid 1 track 1 weight reduced 250
#
track 1 interface GigabitEthernet1/0/2
如图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 VRRP with IPsec配置组网图
· 由于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备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间。
本举例是在R6728版本上进行配置和验证的。
· 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地址拥有者上的VRRP备份组,将导致地址冲突。建议先修改配置了VRRP备份组的接口的IP地址,再删除该接口上的VRRP备份组,以避免地址冲突。
· IPsec隧道两端配置的ACL的源地址和目的地址必须对称。
· IKE协商双方配置的预共享密钥必须相同。
· 对于同一个VRRP备份组的成员设备,必须保证备份组虚拟路由器的IP地址完全一样。
· 用户在配置降低优先级幅度时,需要确保降低后的优先级比VRRP备份组内其他设备的优先级要低,确保VRRP备份组内有其他设备被选为Master。
# 配置接口的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 number 3000
[DeviceA-acl-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-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
[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.100。
[DeviceA-ipsec-policy-isakmp-test-1] local-address 10.0.0.100
# 指定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
# 配置接口的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 number 3000
[DeviceB-acl-adv-3000] rule 0 permit ip source 20.0.0.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
[DeviceB-acl-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
[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.1。
[DeviceB-ipsec-policy-isakmp-test-1] local-address 10.0.0.1
# 指定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
# 配置接口的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 number 3000
[DeviceC-acl-adv-3000] rule 0 permit ip source 20.0.0.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
[DeviceC-acl-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
[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.1。
[DeviceC-ipsec-policy-isakmp-test-1] local-address 10.0.0.1
# 指定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
(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隧道上得以传输。验证方法与上一个步骤相同,此处省略。
· 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 number 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
local-address 10.0.0.100
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
ipsec apply policy test
#
interface GigabitEthernet1/0/2
port link-mode route
ip address 20.0.0.2 255.255.255.0
#
ip route-static 192.168.1.0 255.255.255.0 10.0.0.100
#
acl number 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
local-address 10.0.0.1
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=
#
· Device C:
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 10.0.0.3 255.255.255.0
ipsec apply policy test
#
interface GigabitEthernet1/0/2
port link-mode route
ip address 20.0.0.3 255.255.255.0
#
ip route-static 192.168.1.0 255.255.255.0 10.0.0.100
#
acl number 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
local-address 10.0.0.1
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=
#
· 《H3C MSR 系列路由器 配置指导(V7)》中的“可靠性配置指导”
· 《H3C MSR 系列路由器 命令参考(V7)》中的“可靠性命令参考”
· 《H3C MSR 系列路由器 配置指导(V7)》中的“安全配置指导”
· 《H3C MSR 系列路由器 命令参考(V7)》中的“安全命令参考”
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!