實驗名稱:利用VRRP功能實現簡單的路由器備份
操作系統:RedHat 7.3
所使用的內核:linux-2.4.24
實驗用到的模塊: keepalived-1.16.tar.gz
網絡結構如下圖所示:圖中的V-Gate就是VRRP中的VIP。

網絡中有兩個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
(1)、下載keepalived-1.1.6.tar.gz (http://www.keepalived.org)
(2)、解壓縮:
#tar zxvf keepalived-1.1.6.tar.gz
(3)編譯keepalived
#cd keepalived-1.1.6
#./configure –prefix=/usr/local/keepalived
#make
(4)安裝keepalived
#make install
(5)配置Linux Router Master的VRRP
#vi /usr/local/keepalived/etc/keepalived/keepalived.conf
內容如下:
vrrp_instance VI_1 {
state MASTER
interface eth1
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.3.3
}
}