3. 配置步骤
(1) 配置Router A
# 配置VRRP工作在负载均衡模式。
<RouterA> system-view
[RouterA] vrrp mode load-balance
# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.1。
[RouterA] interface gigabitethernet 2/0/1
[RouterA-GigabitEthernet2/0/1] ip address 10.1.1.2 24
[RouterA-GigabitEthernet2/0/1] vrrp vrid 1 virtual-ip 10.1.1.1
# 配置Router A在备份组1中的优先级为120,高于Router B的优先级110和Router C的优先级100,以保证Router A成为Master。
[RouterA-GigabitEthernet2/0/1] vrrp vrid 1 priority 120
# 配置Router A工作在抢占方式,以保证Router A故障恢复后,能再次抢占成为Master,即只要Router A正常工作,Router A就会成为Master。为了避免频繁地进行状态切换,配置抢占延迟时间为5秒。
[RouterA-GigabitEthernet2/0/1] vrrp vrid 1 preempt-mode delay 5
[RouterA-GigabitEthernet2/0/1] quit
# 创建和上行接口GigabitEthernet2/0/2物理状态关联的Track项1。如果Track项的状态为Negative,则说明Router A的上行接口出现故障。
[RouterA] track 1 interface gigabitethernet 2/0/2
# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Router A上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其它设备接管Router A的转发任务。本例中,配置虚拟转发器权重降低数额为250。
[RouterA] interface gigabitethernet 2/0/1
[RouterA-GigabitEthernet2/0/1] vrrp vrid 1 track 1 weight reduced 250
(2) 配置Router B
# 配置VRRP工作在负载均衡模式。
<RouterB> system-view
[RouterB] vrrp mode load-balance
# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.1。
[RouterB] interface gigabitethernet 2/0/1
[RouterB-GigabitEthernet2/0/1] ip address 10.1.1.3 24
[RouterB-GigabitEthernet2/0/1] vrrp vrid 1 virtual-ip 10.1.1.1
# 配置Router B在备份组1中的优先级为110,高于Router C的优先级100,以保证Router A出现故障时,Router B成为Master。
[RouterB-GigabitEthernet2/0/1] vrrp vrid 1 priority 110
# 配置Router B工作在抢占方式,抢占延迟时间为5秒。
[RouterB-GigabitEthernet2/0/1] vrrp vrid 1 preempt-mode delay 5
[RouterB-GigabitEthernet2/0/1] quit
# 创建和上行接口GigabitEthernet2/0/2物理状态关联的Track项1。如果Track项的状态为Negative,则说明Router B的上行接口出现故障。
[RouterB] track 1 interface gigabitethernet 2/0/2
# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Router B上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其它设备接管Router B的转发任务。本例中,配置虚拟转发器权重降低数额为250。
[RouterB] interface gigabitethernet 2/0/1
[RouterB-GigabitEthernet2/0/1] vrrp vrid 1 track 1 weight reduced 250
(3) 配置Router C
# 配置VRRP工作在负载均衡模式。
<RouterC> system-view
[RouterC] vrrp mode load-balance
# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.1。
[RouterC] interface gigabitethernet 2/0/1
[RouterC-GigabitEthernet2/0/1] ip address 10.1.1.4 24
[RouterC-GigabitEthernet2/0/1] vrrp vrid 1 virtual-ip 10.1.1.1
# 配置Router C工作在抢占方式,抢占延迟时间为5秒。
[RouterC-GigabitEthernet2/0/1] vrrp vrid 1 preempt-mode delay 5
[RouterC-GigabitEthernet2/0/1] quit
# 创建和上行接口GigabitEthernet2/0/2物理状态关联的Track项1。如果Track项的状态为Negative,则说明Router C的上行接口出现故障。
[RouterC] track 1 interface gigabitethernet 2/0/2
# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Router C上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其它设备接管Router C的转发任务。本例中,配置虚拟转发器权重降低数额为250。
[RouterC] interface gigabitethernet 2/0/1
[RouterC-GigabitEthernet2/0/1] vrrp vrid 1 track 1 weight reduced 250
配置完成后,在Host A上可以ping通外网。通过display vrrp verbose命令查看配置后的结果。
# 显示Router A上备份组1的详细信息。
[RouterA-GigabitEthernet2/0/1] display vrrp verbose
IPv4 Virtual Router Information:
Running Mode : Load Balance
Total number of virtual routers : 1
Interface GigabitEthernet2/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
# 显示Router B上备份组1的详细信息。
[RouterB-GigabitEthernet2/0/1] display vrrp verbose
IPv4 Virtual Router Information:
Running Mode : Load Balance
Total number of virtual routers : 1
Interface GigabitEthernet2/0/1
VRID : 1 Adver Timer : 100
Admin Status : Up State : Backup
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Become Master : 426ms left
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
# 显示Router C上备份组1的详细信息。
[RouterC-GigabitEthernet2/0/1] display vrrp verbose
IPv4 Virtual Router Information:
Running Mode : Load Balance
Total number of virtual routers : 1
Interface GigabitEthernet2/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 : 417ms left
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
以上显示信息表示在备份组1中Router A为Master路由器,Router B和Router C 为Backup路由器。Router A、Router B和Router C上各自存在一个AVF,并存在作为备份的两个LVF。
# 当Router A的上行接口GigabitEthernet2/0/2出现故障后,通过display vrrp verbose命令查看Router A上备份组的详细信息。
[RouterA-GigabitEthernet2/0/1] display vrrp verbose
IPv4 Virtual Router Information:
Running Mode : Load Balance
Total number of virtual routers : 1
Interface GigabitEthernet2/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
# 通过display vrrp verbose命令查看Router C上备份组的详细信息。
[RouterC-GigabitEthernet2/0/1] display vrrp verbose
IPv4 Virtual Router Information:
Running Mode : Load Balance
Total number of virtual routers : 1
Interface GigabitEthernet2/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 : 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
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