本文档介绍VRRP的配置举例。
本文档不严格与具体软、硬件版本对应,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文档假设您已了解VRRP、STP和以太网链路聚合特性。
3 IPv4 VRRP单备份组配置举例
如图1所示,Host A所在网络的出口处部署了两台网关设备。现要求使用VRRP主备备份功能,将这两台设备组成一台虚拟路由器,作为Host A的缺省网关。具体应用需求如下:
· 在正常情况下,由Device A承担网关功能,转发Host A发送至外网的流量;
· 当Device A或者Device A的上行接口出现故障时,由Device B接替Device A承担网关功能;
· 当Device A或者Device A的上行接口故障恢复后,由Device A继续承担网关功能。
· 为了让Device A成为Master,需要为Device A配置较高的优先级;
· 将VRRP组的抢占模式和监视上行接口状态功能结合使用,可以使Master设备根据上行接口的状态自动调整自身的VRRP优先级,从而使VRRP组内的角色发生转变,实现主备切换;
· 为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间。
本举例是在S5820V2_5830V2-CMW710-R2432P03版本上进行配置和验证的。
· 备份组的虚拟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。
(1) Device A的配置
# 配置接口IP地址。
[DeviceA] interface ten-gigabitethernet 1/0/1
[DeviceA-Ten-GigabitEthernet1/0/1] quit
[DeviceA] vlan 2
[DeviceA-vlan2] port ten-gigabitethernet 1/0/1
[DeviceA-vlan2] quit
[DeviceA] interface vlan-interface 2
[DeviceA-Vlan-interface2] ip address 192.168.0.2 24
# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为192.168.0.1。
# 设置Device A在VRRP备份组1中的优先级为110,高于Device B的优先级100,以保证Device A成为Master负责转发流量。
# 设置Device A工作在抢占方式,以保证Device A故障恢复后,能再次抢占成为Master,即只要Device A正常工作,就由Device A负责转发流量。为了避免频繁地进行状态切换,配置抢占延迟时间为500厘秒。
[DeviceA-Vlan-interface2] quit
# 创建和上行端口Ten-GigabitEthernet1/0/2关联的Track项1。
[DeviceA] track 1 interface ten-gigabitethernet 1/0/2
# 配置监视Track项1,Track项的状态为Negative时,Device A在VRRP备份组中的优先级降低的数值为50。
[DeviceA] interface vlan-interface 2
[DeviceA-Vlan-interface2] vrrp vrid 1 track 1 priority reduced 50
[DeviceA-Vlan-interface2] quit
(2) Device B的配置
# 配置接口IP地址。
system-view
[DeviceB] interface ten-gigabitethernet 1/0/1
[DeviceB-Ten-GigabitEthernet1/0/1] quit
[DeviceB] vlan 2
[DeviceB-vlan2] port ten-gigabitethernet 1/0/1
[DeviceB-vlan2] quit
[DeviceB] interface vlan-interface 2
[DeviceB-Vlan-interface2] ip address 192.168.0.3 24
# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为192.168.0.1。
[DeviceB-Vlan-interface2] vrrp vrid 1 virtual-ip 192.168.0.1
#设置Device B在VRRP备份组1中的优先级为100。
# 设置Device B工作在抢占方式,抢占延迟时间为500厘秒。
[DeviceB-Vlan-interface2] vrrp vrid 1 preempt-mode delay 500
[DeviceB-Vlan-interface2] quit
3.6 验证配置
# 配置完成后,在Host A上可以ping通Host B。
# 通过display vrrp verbose命令查看配置后的结果,显示Device A上VRRP备份组1的详细信息。
[DeviceA-Vlan-interface2] display vrrp verbose
IPv4 Virtual Router Information:
RunningMode : Standard
Total number of virtual routers
: 1
Interface Vlan-interface2
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-Vlan-interface2] display vrrp verbose
IPv4 Virtual Router Information:
Running Mode
: Standard
Total number of virtual routers
: 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up
State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 500
Become Master : 401ms 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-Vlan-interface2] display vrrp verbose
IPv4 Virtual Router Information:
RunningMode : Standard
Total number of virtual routers
: 1
Interface Vlan-interface2
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 A上VRRP备份组1的详细信息。
[DeviceA-Vlan-interface2] display vrrp verbose
IPv4 Virtual Router Information:
RunningMode : Standard
Total number of virtual routers
: 1
Interface Vlan-interface2
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会抢占成为Master,Host A发送给Host B的报文仍然通过Device A转发。
3.7 配置文件
· Device A的配置文件:
#
vlan 2
#
interface Vlan-interface2
ip address 192.168.0.1 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.0.2
vrrp vrid 1 priority 110
vrrp vrid 1 preempt-mode delay 500
vrrp vrid 1 track 1 priority reduced 50
#
interface Vlan-interface3
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 2
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 3
#
track 1 interface Ten-GigabitEthernet1/0/2
#
· Device B的配置文件:
#
vlan 2
#
interface Vlan-interface2
ip address 192.168.0.1 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.0.2
vrrp vrid 1 priority 100
vrrp vrid 1 preempt-mode delay 500
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 2
#
4 IPv4 VRRP多备份组配置举例
如图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的网关功能。
· 为了让Device A和Device B分别成为VRRP备份组1和VRRP备份组2中的Master,需要在VRRP备份组1中为Device A配置较高的优先级,在VRRP备份组2中为Device B配置较高的优先级。
· 为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间。
· 为了避免网关设备(Device A和Device B)与二层交换机形成二层环路,使用STP协议在每个VRRP备份组中阻塞一个端口。
本举例是在S5820V2_5830V2-CMW710-R2432P03版本上进行配置和验证的。
· 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地址
¡ 定时器间隔时间
(1) Device A的配置
# 配置接口IP地址。
system-view
[DeviceA] interface ten-gigabitethernet 1/0/1
[DeviceA-Ten-GigabitEthernet1/0/1] quit
[DeviceA] vlan 101
[DeviceA-vlan101] port ten-gigabitethernet 1/0/1
[DeviceA-vlan101] quit
[DeviceA] interface vlan-interface 101
[DeviceA-Vlan-interface101] ip address 10.0.0.2 24
[DeviceA-Vlan-interface101] quit
# 请参考以上方法配置图2中其它接口的IP地址,配置步骤这里省略。
# 配置两个网关设备间采用Trunk口直连,允许VLAN 101和VLAN 102的报文通过
[DeviceA] interface ten-gigabitethernet 1/0/24
[DeviceA-Ten-GigabitEthernet1/0/24] port link-type trunk
[DeviceA-Ten-GigabitEthernet1/0/24] undo port trunk permit vlan 1
[DeviceA-Ten-GigabitEthernet1/0/24] port trunk permit vlan 101 to 102
[DeviceA-Ten-GigabitEthernet1/0/24] port trunk pvid vlan 101
[DeviceA-Ten-GigabitEthernet1/0/24] quit
# 关闭Ten-GigabitEthernet1/0/2的STP功能
[DeviceA] interface ten-gigabitethernet 1/0/2
[DeviceA-Ten-GigabitEthernet1/0/2] undo stp enable
[DeviceA-Ten-GigabitEthernet1/0/2] quit
# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为10.0.0.1,并配置Device A在VRRP备份组1中的优先级为120,高于Device B的优先级。
[DeviceA] interface vlan-interface 101
[DeviceA-Vlan-interface101] vrrp vrid 1 virtual-ip 10.0.0.1
[DeviceA-Vlan-interface101] vrrp vrid 1 priority 120
[DeviceA-Vlan-interface101] quit
# 创建VRRP备份组2,并配置VRRP备份组2的虚拟IP地址为11.0.0.1。
[DeviceA] interface vlan-interface 102
[DeviceA-Vlan-interface102] vrrp vrid 2 virtual-ip 11.0.0.1
[DeviceA-Vlan-interface102] quit
# 设置Device A工作在抢占方式,配置抢占延迟时间为500厘秒。
[DeviceA] interface vlan-interface 101
[DeviceA-Vlan-interface101] vrrp vrid 1 preempt-mode delay 500
[DeviceA-Vlan-interface101] quit
# 创建和上行端口Ten-GigabitEthernet1/0/2关联的Track项1。
[DeviceA] track 1 interface ten-gigabitethernet 1/0/2
# 配置监视Track项1,Track项的状态为Negative时,Device A在VRRP备份组1中的优先级降低的数值为50。
[DeviceA] interface vlan-interface 101
[DeviceA-Vlan-interface101] vrrp vrid 1 track 1 priority reduced 50
[DeviceA-Vlan-interface101] quit
# 配置MSTP,将VLAN101映射到MSI 1,VLAN102映射到MSI 2,并将Device A作为MSI 1的根桥。
[DeviceA] stp region-configuration
[DeviceA-mst-region] region-name vrrp
[DeviceA-mst-region] instance 1 vlan 101
[DeviceA-mst-region] instance 2 vlan 102
[DeviceA-mst-region] active region-configuration
[DeviceA-mst-region] quit
[DeviceA] stp instance 1 root primary
[DeviceA] stp instance 2 root secondary
[DeviceA] stp global enable
(2) Device B的配置
system-view
[DeviceB] interface ten-gigabitethernet 1/0/1
[DeviceB-Ten-GigabitEthernet1/0/1] quit
[DeviceB] vlan 101
[DeviceB-vlan101] port ten-gigabitethernet 1/0/1
[DeviceB-vlan101] quit
[DeviceB] interface vlan-interface 101
[DeviceB-Vlan-interface101] ip address 10.0.0.3 24
[DeviceB-Vlan-interface101] quit
# 请参考以上方法配置图2中其它接口的IP地址,配置步骤省略。
# 配置两个网关设备间采用trunk口直连,允许VLAN 101和VLAN 102的报文通过
[DeviceB] interface ten-gigabitethernet 1/0/24
[DeviceB-Ten-GigabitEthernet1/0/24] port link-type trunk
[DeviceB-Ten-GigabitEthernet1/0/24] undo port trunk permit vlan 1
[DeviceB-Ten-GigabitEthernet1/0/24] port trunk permit vlan 101 to 102
[DeviceB-Ten-GigabitEthernet1/0/24] port trunk pvid vlan 101
[DeviceB-Ten-GigabitEthernet1/0/24] quit
# 关闭Ten-GigabitEthernet1/0/2的STP功能
[DeviceB] interface ten-gigabitethernet 1/0/2
[DeviceB-Ten-GigabitEthernet1/0/2] undo stp enable
[DeviceB-Ten-GigabitEthernet1/0/2] quit
# 创建VRRP备份组1,并配置VRRP备份组1的虚拟IP地址为10.0.0.1。
[DeviceB] interface vlan-interface 101
[DeviceB-Vlan-interface101] vrrp vrid 1 virtual-ip 10.0.0.1
[DeviceB-Vlan-interface101] quit
# 创建VRRP备份组2,并配置VRRP备份组2的虚拟IP地址为11.0.0.1,并配置Device B在VRRP备份组2中的优先级为120,高于Device A的优先级。
[DeviceB] interface vlan-interface 102
[DeviceB-Vlan-interface102] vrrp vrid 2 virtual-ip 11.0.0.1
[DeviceB-Vlan-interface102] vrrp vrid 2 priority 120
# 设置Device B工作在抢占方式,配置抢占延迟时间为500厘秒。
[DeviceB-Vlan-interface102] vrrp vrid 2 preempt-mode delay 500
[DeviceB-Vlan-interface102] quit
# 创建和上行端口Ten-GigabitEthernet1/0/2关联的Track项2。
[DeviceB] track 2 interface ten-gigabitethernet 1/0/2
# 配置监视Track项2,Track项的状态为Negative时,Device B在VRRP备份组2中的优先级降低的数值为50。
[DeviceB] interface vlan-interface 102
[DeviceB-Vlan-interface102] vrrp vrid 2 track 2 priority reduced 50
[DeviceB-Vlan-interface102] quit
# 配置MSTP,将VLAN101映射到MSI 1,VLAN102映射到MSI 2,并将Device B作为MSI 2的根桥。
[DeviceB] stp region-configuration
[DeviceB-mst-region] region-name vrrp
[DeviceB-mst-region] instance 1 vlan 101
[DeviceB-mst-region] instance 2 vlan 102
[DeviceB-mst-region] active region-configuration
[DeviceB-mst-region] quit
[DeviceB] stp instance 2 root primary
[DeviceB] stp instance 1 root secondary
[DeviceB] stp global enable
(3) L2SwitchA的配置
# 配置MSTP,将VLAN101映射到MSI 1,激活MSTI配置,全局使能STP协议。
system-view
[L2SwitchA] stp region-configuration
[L2SwitchA-mst-region] region-name vrrp
[L2SwitchA-mst-region] instance 1 vlan 101
[L2SwitchA-mst-region] active region-configuration
[L2SwitchA-mst-region] quit
[L2SwitchA] stp global enable
(4) L2SwitchB的配置
# 配置MSTP,将VLAN102映射到MSI 1,激活MSTI配置,全局使能STP协议。
system-view
[L2SwitchB] stp region-configuration
[L2SwitchB-mst-region] region-name vrrp
[L2SwitchB-mst-region] instance 1 vlan 102
[L2SwitchB-mst-region] active region-configuration
[L2SwitchB-mst-region] quit
[L2SwitchB] stp global enable
4.6 验证配置
(1) 配置完成后,区域A和区域B中的主机都可以ping通外网。
# 检查区域A的主机到目的端100.0.0.1是否可达。
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是否可达。
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在备份组1中为Master设备,在备份组2中为Backup设备。
[DeviceA] display vrrp verbose
IPv4 Virtual Router Information:
Running Mode : Standard
Total number of virtual routers
: 2
Interface Vlan-interface101
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 Vlan-interface102
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
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 Vlan-interface101
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
Virtual IP : 10.0.0.1
Master IP: 10.0.0.2
Interface Vlan-interface102
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抢占为备份组1的Master。
[DeviceB] display vrrp verbose
IPv4 Virtual Router Information:
Running Mode
: Standard
Total number of virtual routers
: 2
Interface Vlan-interface101
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 Vlan-interface102
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 Vlan-interface101
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 Vlan-interface102
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,VLAN 101内的主机通过Device A与外界通信。
4.7 配置文件
· Device A的配置文件:
#
vlan 101 to 102
#
vlan 4094
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp instance 1 root primary
stp global enable
#
interface Vlan-interface101
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 Vlan-interface102
ip address 11.0.0.2 255.255.255.0
vrrp vrid 2 virtual-ip 11.0.0.1
#
interface Vlan-interface4094
ip address 100.0.0.2 255.255.255.0
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 101
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 4094
undo stp enable
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port access vlan 102
#
interface Ten-GigabitEthernet1/0/24
port link-mode bridge
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
#
track 1 interface ten-gigabitethernet1/0/2
#
· Device B的配置文件:
#
vlan 101 to 102
#
vlan 4094
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp instance 2 root primary
stp global enable