VRRP功能实现双向路由链路的备份
利用VRRP实现双向链路的(图)
VRRP的上一个实验(利用VRRP功能实现简单的路由器备份)只能实现路由器一个接口的备份,但路由器通常最少有两个接口,当两个接口中的任 意一个有故障时,都将导致网络不可到达的故障,所以我们要对的两个接口进行监控,当Master Linux路由器的任何一个网络接口出现故障时,Backup Linux路由器都会接管Master的工作。在Keepalived中是很容易做到的。
实验名称:利用VRRP功能实现双向路由链路的备份
操作系统:RedHat 7.3
所使用的内核:linux-2.4.24
实验用到的模块: keepalived-1.16.tar.gz (如果对VRRP和Keepalived不太了解,先看看这里)
网络结构如下图所示:
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/uploads/allimg/100111/204325M03-0.gif');}" onmousewheel="return imgzoom(this);" alt="" />
网络中有两个Linux Router:
(1), Master(eth0:192.168.1.10/24接外网; eth1:192.168.3.1/24接内网)
(2), Backup(eth0:192.168.2.10/24接外网; eth1:192.168.3.2/24接内网)
内网的IP地址段为192.168.3.0/24,网关(V-Gate)为192.168.3.3/24,记住192.168.3.3/24这个地址是在Keepalived启动时生效的。
首先我们在Linux Router Master上安装keepalived-1.1.6.tar.gz,方法见(利用VRRP功能实现简单的路由器备份)
配置Linux Router Master的VRRP,
#vi /usr/local/keepalived/etc/keepalived/keepalived.conf
内容如下:
--------------------------------------------------------------------------------
vrrp_instance VI_1 {
state MASTER
interface eth1
track_interface { # Interfaces state we monitor
eth0
}
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.3.3
}
}
--------------------------------------------------------------------------------
在Linux Router Backup上安装keepalived的方法是相同的,不同的是配置文件/usr/local/keepalived/etc/keepalived/keepalived.conf,如下:
--------------------------------------------------------------------------------
vrrp_instance VI_1 {
state BACKUP
interface eth1
track_interface { # Interfaces state we monitor
eth0
}
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.3.3
}
}
--------------------------------------------------------------------------------
用同样的方法启动Backup上的keepalived
#/usr/local/keepalived/sbin/keepalived –D –f /usr/local/keepalived/etc/keepalived/keepalived.conf
这样,当Master上的eth0,eth1中的任何一个接口失效时,Backup就会通过MultiCast地址:224.0.0.18这个组播地址,获得这个消息,并将192.168.3.3这个地址接管过来。
- 最新评论