1.1.2
VRRP监视接口配置举例
l
Host A需要访问Internet上的Host B,Host A的缺省网关为202.38.160.111/24;
l
Router
A和Router B属于虚拟IP地址为202.38.160.111/24的备份组1;
l
当Router A正常工作时,Host A发送给Host B的报文通过Router A转发;当Router A连接Internet的接口GigabitEthernet4/1/2不可用时,自动降低其优先级,从而RouteB成为Master, Host A发送给Host B的报文通过Router B转发。
图1 VRRP监视接口配置组网图
<RouterA>
system-view
[RouterA]
interface GigabitEthernet
[RouterA-GigabitEthernet4/1/1]
ip address 202.38.160.1 255.255.255.0
#
创建备份组1,并配置备份组1的虚拟IP地址为202.38.160.111。
[RouterA-GigabitEthernet4/1/1]
vrrp vrid 1 virtual-ip 202.38.160.111
#
设置Router
A在备份组1中的优先级为110。
[RouterA-GigabitEthernet4/1/1]
vrrp vrid 1 priority 110
#
设置备份组的认证方式为SIMPLE,认证字为hello。
[RouterA-GigabitEthernet4/1/1]
vrrp vrid 1 authentication-mode simple hello
#
设置Master路由器发送VRRP报文的间隔时间为5秒。
[RouterA-GigabitEthernet4/1/1]
vrrp vrid 1 timer advertise 5
#
设置Router
A工作在抢占方式,抢占延迟时间为5秒。
[RouterA-GigabitEthernet4/1/1]
vrrp vrid 1 preempt-mode timer delay 5
#
设置监视接口。
[RouterA-GigabitEthernet4/1/1]
vrrp vrid 1 track interface GigabitEthernet
<RouterB>
system-view
[RouterB]
interface GigabitEthernet
[RouterB-GigabitEthernet4/1/1]
ip address 202.38.160.2 255.255.255.0
# 创建备份组1,并配置备份组1的虚拟IP地址为202.38.160.111。
[RouterB-GigabitEthernet4/1/1]
vrrp vrid 1 virtual-ip 202.38.160.111
# 设置备份组的认证方式为SIMPLE,认证字为hello。
[RouterB-GigabitEthernet4/1/1]
vrrp vrid 1 authentication-mode simple hello
# 设置Master路由器发送VRRP报文的间隔时间为5秒。
[RouterB-GigabitEthernet4/1/1]
vrrp vrid 1 timer advertise 5
# 设置Router B工作在抢占方式,抢占延迟时间为5秒。
[RouterB-GigabitEthernet4/1/1]
vrrp vrid 1 preempt-mode timer delay 5
配置完成后,在Host A上可以ping通Host B。通过display vrrp verbose命令查看配置后的结果。
# 显示RouterA上备份组1的详细信息。
[RouterA-GigabitEthernet4/1/1]
display vrrp verbose
IPv4 Standby
Information:
Run Method :
REAL-MAC
Virtual IP Ping :
Enable
Interface :
GigabitEthernet4/1/1
VRID
: 1
Adver. Timer :
5
Admin Status : UP
State
: Master
Config Pri : 110
Run Pri
: 110
Preempt Mode : YES
Delay
Time :
5
Auth Type : SIMPLE
TEXT
Key
: hello
Track IF :
GigabitEthernet4/1/2 Pri Reduced :
30
Virtual IP :
202.38.160.111
Virtual MAC :
00e0-fc62-709f
Master IP :
202.38.160.1
# 显示Router B上备份组1的详细信息。
[RouterB-GigabitEthernet4/1/1]
display vrrp verbose
IPv4 Standby
Information:
Run Method :
REAL-MAC
Virtual IP Ping :
Enable
Interface :
GigabitEthernet4/1/1
VRID
: 1
Adver. Timer :
5
Admin Status : UP
State
: Backup
Config Pri : 100
Run Pri
: 100
Preempt Mode : YES
Delay Time
: 5
Auth Type : SIMPLE
TEXT
Key
: hello
Virtual IP :
202.38.160.111
Master IP :
202.38.160.1
以上显示信息表示在备份组1中Router A为Master路由器,Router B为Backup路由器,Host A发送给Host B的报文通过Router A转发。
Router A连接Internet的接口GigabitEthernet4/1/2不可用时,在Host A上仍然可以ping通Host B。通过display vrrp verbose命令查看备份组的信息。
# Router A的接口GigabitEthernet4/1/2不可用时,显示Router A上备份组1的详细信息。
[RouterA-GigabitEthernet4/1/1]
display vrrp verbose
IPv4
Standby Information:
Run Method :
REAL-MAC
Virtual IP Ping :
Enable
Interface :
GigabitEthernet4/1/1
VRID
: 1
Adver. Timer :
5
Admin Status : UP
State
: Backup
Config Pri : 110
Run Pri
: 80
Preempt Mode : YES
Delay Time
: 5
Auth Type : SIMPLE
TEXT
Key
: hello
Track IF :
GigabitEthernet4/1/2 Pri Reduced :
30
Virtual IP :
202.38.160.111
Master IP :
202.38.160.2
# Router A的接口GigabitEthernet4/1/2不可用时,显示Router B上备份组1的详细信息。
[RouterB-GigabitEthernet4/1/1]
display vrrp verbose
IPv4 Standby
Information:
Run Method :
REAL-MAC
Virtual IP Ping :
Enable
Interface :
GigabitEthernet4/1/1
VRID
: 1
Adver. Timer :
5
Admin Status : UP
State
: Master
Config Pri : 100
Run Pri
: 100
Preempt Mode : YES
Delay Time
: 5
Auth Type : SIMPLE
TEXT
Key
: hello
Virtual IP :
202.38.160.111
Virtual MAC :
00e0-fc61-508f
Master IP :
202.38.160.2
以上显示信息表示Router A的接口GigabitEthernet4/1/2不可用时,Router A的优先级降低为80,成为Backup路由器,Router B成为Master路由器,Host A发送给Host B的报文通过Router B转发。
RouterA
#
interface
GigabitEthernet4/1/1
port link-mode
route
ip address 202.38.160.1
255.255.255.0
vrrp vrid 1 virtual-ip
202.38.160.111
vrrp vrid 1 priority
110
vrrp vrid 1 preempt-mode timer delay
5
vrrp vrid 1 track interface
GigabitEthernet4/1/2 reduced 30
vrrp vrid 1 authentication-mode simple
hello
#
RouterB
#
interface
GigabitEthernet4/1/1
port link-mode
route
ip address 202.38.160.2
255.255.255.0
vrrp vrid 1 virtual-ip
202.38.160.111
vrrp vrid 1 preempt-mode timer delay
5
vrrp vrid 1 authentication-mode simple
hello
#