cd lvs-fullnat-synproxy/ cp lvs-tools.tar.gz /home/pukong cd /home/pukong/ tar xzf lvs-tools.tar.gz;
解壓縮完以後,會有一個tools文件夾。 後端
cd /home/pukong/tools/keepalived; yum -y install popt-devel openssl-devel ./configure --with-kernel-dir="/lib/modules/`uname -r`/build";
執行完上一步,出現一下信息,表示keepalived編譯成功ide
Keepalived configuration ------------------------ Keepalived version : 1.2.2 Compiler : gcc Compiler flags : -g -O2 Extra Lib : -lpopt -lssl -lcrypto Use IPVS Framework : Yes IPVS sync daemon support : Yes IPVS use libnl : No Use VRRP Framework : Yes Use Debug flags : No
而後繼續執行一下步驟ui
make; make install; mkdir /etc/keepalived -pv cp -a bin/keepalived /sbin/ cp -a keepalived/etc/init.d/keepalived.init /etc/init.d/keepalived cp -a keepalived/etc/keepalived/keepalived.conf /etc/keepalived cp -a keepalived/etc/init.d/keepalived.sysconfig /etc/sysconfig/keepalived
[root@lvs-fullnat-one ~]# service keepalived status keepalived is stopped [root@lvs-fullnat-one ~]# service keepalived start Starting keepalived: [ OK ] [root@lvs-fullnat-one ~]# service keepalived status keepalived (pid 9057) is running... [root@lvs-fullnat-one ~]#
注:這裏必須安裝壓縮包中的ipvsadm,由於yum源中的ipvsadm是沒有fullnat模式參數的。 this
cd /home/pukong/tools/ipvsadm; make; make install;
[root@lvs-fullnat-one ipvsadm]# ipvsadm -ln IP Virtual Server version 1.2.1 (size=4194304) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.200.100:443 rr persistent 50 TCP 10.10.10.2:1358 rr persistent 50 -> 192.168.200.200:1358 Masq 1 0 0 TCP 10.10.10.3:1358 rr persistent 50 [root@lvs-fullnat-one ipvsadm]# ipvsadm -h ... ... --ipip -i ipip encapsulation (tunneling) --fullnat -b fullnat mode --masquerading -m masquerading (NAT) ... ...
出現以上回顯表示成功。但有的後端在,有的後端不在回顯中,是由於配置參數引發的。具體看keepalived的配置指導。rest
yum -y install quagga
[root@lvs-fullnat-one quagga]# cat zebra.conf hostname lvs-fullnat-one password zebra enable password zebra [root@lvs-fullnat-one quagga]# service zebra start Starting zebra: [ OK ] [root@lvs-fullnat-one quagga]# chkconfig zebra on [root@lvs-fullnat-one quagga]# vtysh Hello, this is Quagga (version 0.99.15). Copyright 1996-2005 Kunihiro Ishiguro, et al. lvs-fullnat-one# conf t lvs-fullnat-one(config)# exit lvs-fullnat-one# wr Building Configuration... Configuration saved to /etc/quagga/zebra.conf [OK] lvs-fullnat-one# exit [root@lvs-fullnat-one quagga]#
[root@lvs-fullnat-one quagga]# cp ospfd.conf.sample ospfd.conf [root@lvs-fullnat-one quagga]# service ospfd start Starting ospfd: [ OK ] [root@lvs-fullnat-one quagga]# chkconfig ospfd on
[root@lvs-fullnat-one quagga]# cat zebra.conf log file /var/log/quagga/zebra.log [root@lvs-fullnat-one quagga]# cat ospfd.conf log file /var/log/quagga/ospfd.log [root@lvs-fullnat-one quagga]# service zebra restart Shutting down zebra: [ OK ] Starting zebra: [ OK ] [root@lvs-fullnat-one quagga]# service ospfd restart Shutting down ospfd: [ OK ] Starting ospfd: [ OK ] [root@lvs-fullnat-one quagga]#
vi /etc/sysctl.conf --> net.ipv4.ip_forward=1 (永久開啓) sysctl -p