好消息,超酷的在线虚拟网络实验室上线了!点击开始实验

为获得更好的浏览效果,建议您使用 Firefox 或者 Chrome 浏览器



12.3   VRRP的配置

【需求】

pc机网关指向两台路由器的虚ip。两台路由器用vrrp实现主机备份。

【组网图】

 

【配置脚本】

RouterA配置脚本

#

sysname RouterA

#

vrrp ping-enable                     /使能VRRP ping/

#

radius scheme system

#

domain system

#

interface Ethernet1/0/0

ip address 10.0.0.1 255.255.255.0

vrrp vrid 1 virtual-ip 10.0.0.254         /配置虚ip/

vrrp vrid 1 priority 120                  /设置优先级120,高于100/

vrrp vrid 1 track Serial2/0/0 reduced 30  /设置监视接口/

#

interface Serial2/0/0

link-protocol ppp

ip address 20.0.0.2 255.255.255.252

#

interface NULL0

#

ip route-static 0.0.0.0 0.0.0.0 20.0.0.1 preference 60

#

user-interface con 0

user-interface vty 0 4

#

return

RouterB配置脚本

#

sysname RouterB

#

vrrp ping-enable                    /使能VRRP ping/

#

radius scheme system

#

domain system

#

interface Ethernet1/0/0

ip address 10.0.0.2 255.255.255.0

vrrp vrid 1 virtual-ip 10.0.0.254   /配置虚ip,优先级默认为100/

#

interface Serial2/0/0

link-protocol ppp

ip address 20.0.0.6 255.255.255.252

#

interface NULL0

#

ip route-static 0.0.0.0 0.0.0.0 20.0.0.5 preference 60

#

user-interface con 0

user-interface vty 0 4

#

return

 

【验证】

正常情况下查看RouterARouterBVRRP状态如下:

RouterA状态

[RouterA]disp vrrp

Virtual Ip Ping : Enable

Ethernet1/0/0 | Virtual Router 1

state : Master

Virtual IP : 10.0.0.254

Config Priority : 120

Run Priority : 120

Preempt : YES   Delay Time : 0

Timer : 1

Auth Type : NONE

Track IF : Serial2/0/0   Priority reduced : 30

RouterB状态

[RouterB]disp vrrp

Virtual Ip Ping : Enable

Ethernet1/0/0 | Virtual Router 1

state : Backup

Virtual IP : 10.0.0.254

Config Priority : 100

Run Priority : 100

Preempt : YES   Delay Time : 0

Timer : 1

Auth Type : NONE

 

RouterA上行口S2/0/0 down后查看RouterARouterB的VRRP状态如下:

RouterA状态

[RouterA]disp vrrp

Virtual Ip Ping : Enable

Ethernet1/0/0 | Virtual Router 1

state : Backup

Virtual IP : 10.0.0.254

Config Priority : 120

Run Priority : 90

Preempt : YES   Delay Time : 0

Timer : 1

Auth Type : NONE

Track IF : Serial2/0/0   Priority reduced : 30

RouterB状态

[RouterB]disp vrrp

Virtual Ip Ping : Enable

Ethernet1/0/0 | Virtual Router 1

state : Master

Virtual IP : 10.0.0.254

Config Priority : 100

Run Priority : 100

Preempt : YES   Delay Time : 0

Timer : 1

Auth Type : NONE

 

【提示】

1、  配置vrrp ping-enable,会出现无法ping网关的现象,但是转发正常。

2、  VRRP的默认工作在抢占方式(Preempt=YES

X Close
X Close