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