1、VRRP作为网关可靠性的常用方法,基本思路是,两台路由器组成一个虚拟路由器,通过VRRP协议对内网呈现一个虚拟的网关ip, 以便让局域网内部的终端通过这个虚拟网关对外进行通信。

 

2、VRRP的最简单配置就是一条命令,分别在两个路由器的对内网端口上配置。

vrrp vrid 1 virtual-ip x

 

3、VRRP也可以实现为负载均衡的配置,实现两个路由器同时转发流量。

 

4、VRRP也可以配置监测上行端口的拥塞情况,作为VRRP主动调整自己的优先级的依据,从而让两个路由器协商出更好的网关。

 

4、以eNSP的实验为例,

组网图:

 

 

关键配置:

VRRP配置:

R1的配置:

#
interface GigabitEthernet0/0/1
ip address 192.168.0.10 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.0.1
#

 

R2的配置:

#
interface GigabitEthernet0/0/2
ip address 192.168.0.20 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.0.1
#

 

等价路由的配置:

R3上配置到192.168.0.0 网段的两条等价路由

#
ip route-static 192.168.0.0 255.255.255.0 2.0.0.10
ip route-static 192.168.0.0 255.255.255.0 3.0.0.10
#

 

检查VRRP运行结果:

在R1上查看VRRP的运行结果:

<Huawei>display vrrp 1
GigabitEthernet0/0/1 | Virtual Router 1
State : Master
Virtual IP : 192.168.0.1
Master IP : 192.168.0.10
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 100
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Create time : 2017-10-22 17:21:39 UTC-08:00
Last change time : 2017-10-22 17:21:43 UTC-08:00

<Huawei>

<Huawei>display vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Master GE0/0/1 Normal 192.168.0.1
----------------------------------------------------------------
Total:1 Master:1 Backup:0 Non-active:0
<Huawei>

 

在R2上查看VRRP的运行结果

<Huawei>display vrrp
GigabitEthernet0/0/2 | Virtual Router 1
State : Backup
Virtual IP : 192.168.0.1
Master IP : 192.168.0.10
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 100
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Create time : 2017-10-22 17:34:29 UTC-08:00
Last change time : 2017-10-22 17:34:29 UTC-08:00

<Huawei>

<Huawei>display vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Backup GE0/0/2 Normal 192.168.0.1
----------------------------------------------------------------
Total:1 Master:0 Backup:1 Non-active:0
<Huawei>

从上述结果看,左边的路由器是VRRP的主路由器。

 

验证路由器故障的情况:

1、关闭左边路由器

查看R2上VRRP状态

<Huawei>display vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Master GE0/0/2 Normal 192.168.0.1
----------------------------------------------------------------
Total:1 Master:1 Backup:0 Non-active:0
<Huawei>display vrrp
GigabitEthernet0/0/2 | Virtual Router 1
State : Master
Virtual IP : 192.168.0.1
Master IP : 192.168.0.20
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 100
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Create time : 2017-10-22 17:34:29 UTC-08:00
Last change time : 2017-10-22 17:58:11 UTC-08:00

<Huawei>

 

验证从PC1 ping PC3,可见可以ping 通

PC>ping 10.0.0.102

Ping 10.0.0.102: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 10.0.0.102: bytes=32 seq=2 ttl=126 time=187 ms
From 10.0.0.102: bytes=32 seq=3 ttl=126 time=94 ms
From 10.0.0.102: bytes=32 seq=4 ttl=126 time=94 ms
From 10.0.0.102: bytes=32 seq=5 ttl=126 time=109 ms

--- 10.0.0.102 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/121/187 ms

PC>

 

posted on 2017-10-22 17:58  爱编程的小兵  阅读(1247)  评论(0编辑  收藏  举报