1. Copy The LVS-tools compressed package
cd lvs-fullnat-synproxy/cp lvs-tools.tar.gz /home/pukongcd /home/pukong/tar xzf lvs-tools.tar.gz;
After decompression, there will be a tool folder.
2. Install keepalived
cd /home/pukong/tools/keepalived;yum -y install popt-devel openssl-devel./configure --with-kernel-dir="/lib/modules/`uname -r`/build";
After the previous step is executed, the following message appears, indicating that keepalived has been compiled successfully.
Keepalived configuration------------------------Keepalived version : 1.2.2Compiler : gccCompiler flags : -g -O2Extra Lib : -lpopt -lssl -lcrypto Use IPVS Framework : YesIPVS sync daemon support : YesIPVS use libnl : NoUse VRRP Framework : YesUse Debug flags : No
Then proceed to the next step.
make;make install;mkdir /etc/keepalived -pvcp -a bin/keepalived /sbin/cp -a keepalived/etc/init.d/keepalived.init /etc/init.d/keepalivedcp -a keepalived/etc/keepalived/keepalived.conf /etc/keepalivedcp -a keepalived/etc/init.d/keepalived.sysconfig /etc/sysconfig/keepalived
2.1 check whether keepalived is successfully installed
[[email protected] ~]# service keepalived statuskeepalived is stopped[[email protected] ~]# service keepalived startStarting keepalived: [ OK ][[email protected] ~]# service keepalived statuskeepalived (pid 9057) is running...[[email protected] ~]#
3. Install ipvsadm
Note: ipvsadm must be installed in the compressed package, because ipvsadm In the yum source does not have the fullnat mode parameter.
cd /home/pukong/tools/ipvsadm;make;make install;
3.1 check whether ipvsadm is successfully installed
[[email protected] ipvsadm]# ipvsadm -lnIP Virtual Server version 1.2.1 (size=4194304)Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConnTCP 192.168.200.100:443 rr persistent 50TCP 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[[email protected] ipvsadm]# ipvsadm -h...... --ipip -i ipip encapsulation (tunneling) --fullnat -b fullnat mode --masquerading -m masquerading (NAT)......
The above ECHO is successful. However, some backend and some backend are not displayed because of configuration parameters. For more information, see the Configuration Guide of keepalived.
4. Install quaage (dynamic routing software)
yum -y install quagga
4.1 configure the zebra service
[[email protected] quagga]# cat zebra.confhostname lvs-fullnat-onepassword zebraenable password zebra[[email protected] quagga]# service zebra startStarting zebra: [ OK ][[email protected] quagga]# chkconfig zebra on [[email protected] quagga]# vtyshHello, this is Quagga (version 0.99.15).Copyright 1996-2005 Kunihiro Ishiguro, et al.lvs-fullnat-one# conf tlvs-fullnat-one(config)# exitlvs-fullnat-one# wrBuilding Configuration...Configuration saved to /etc/quagga/zebra.conf[OK]lvs-fullnat-one# exit[[email protected] quagga]#
4.2 configure the OSPF Service
[[email protected] quagga]# cp ospfd.conf.sample ospfd.conf[[email protected] quagga]# service ospfd startStarting ospfd: [ OK ][[email protected] quagga]# chkconfig ospfd on
4.3 configure the Log Path
[[email protected] quagga]# cat zebra.conflog file /var/log/quagga/zebra.log[[email protected] quagga]# cat ospfd.conflog file /var/log/quagga/ospfd.log[[email protected] quagga]# service zebra restartShutting down zebra: [ OK ]Starting zebra: [ OK ][[email protected] quagga]# service ospfd restartShutting down ospfd: [ OK ]Starting ospfd: [ OK ][[email protected] quagga]#
5. Modify Kernel Parameters
Net. ipv4.ip_forward, Allow packet forwarding
VI/etc/sysctl. conf --> net. ipv4.ip _ forward = 1 (permanently enabled) sysctl-P
LVS fullnat + ecmp [2] install keepalived + ipvsadm + quaage