fullnat mode of LVS

Kernel compilation required:
On server8:

#Get compiled dependency package
get Lvs-fullnat-synproxy.tar.gz 
#Get dependency Library
newt-devel-0.52.11-3.el6.x86_64.rpm slang-devel-2.2.1-1.el6.x86_64.rpm asciidoc-8.4.5-4.1.el6.noarch.rpm 

rpm -ivh kernel-2.6.32-220.23.1.el6.src.rpm

tar zxf Lvs-fullnat-synproxy.tar.gz
cd lvs-fullnat-synproxy/
cd rpmbuild/SPECS/
yum install -y rpm-build    #Press the install rpmbuild command
#Install build dependency Library

yum install -y gcc redhat-rpm-config patchutils xmlto asciidoc-8.4.5-4.1.el6.noarch.rpm elfutils-libelf-devel zlib-devel binutils-devel newt-devel-0.52.11-3.el6.x86_64.rpm python-devel perl-ExtUtils-Embed hmaccalc slang-devel-2.2.1-1.el6.x86_64.rpm

cd rpmbuild/SPECS/      #Need to switch to this directory
rpmbuild -bp kernel.spec

//To quickly end compilation: ssh root on another terminal@
 yum install -y rng-tools
 rngd -r /dev/urandom 
//Quick end of installation

#patch up:
cd kernel-2.6.32-220.23.1.el6/
cd linux-2.6.32-220.23.1.el6.x86_64/
cp /root/lvs-fullnat-synproxy/lvs-2.6.32-220.23.1.el6.patch .
patch -p1 < lvs-2.6.32-220.23.1.el6.patch   
 vim Makefile
EXTRAVERSION = -220.23.1.el6.x86_64 #x revision number

//You can use uname -r to check and see

 vim .config
 770 CONFIG_IP_VS_TAB_BITS=22           

Note that the main purpose of modifying the parameters in the. config file is to increase the maximum number of VS connections and the throughput (concurrent connections) of VS. if the value is only the original 4096, packet loss may occur

After printing the core:

make                                make modules_install 
make install
cd /boot/
vim grub/grub.conf 
10 default=0   #There are two boot sections in the boot file, one is the linux of the original kernel, the other is the newly compiled kernel. The newly compiled kernel is on the top of the boot filedefaultValue setting ofFor 0,That is to say, the new kernel is used to boot the system.

To install keepalived:

cd lvs-fullnat-synproxy/
tar zxf lvs-tools.tar.gz
cd tools/keepalived
#Install dependency package:
 yum install -y openssl-devel popt-devel
./configure --with-kernel-dir="/lib/modules/`uname -r`/build"
make install

#Make soft connection:
  ln -s /usr/local/etc/keepalived/ /etc/                                      
  ln -s /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
  ln -s /usr/local/etc/rc.d/init.d/keepalived /etc/init.d/
  ln -s /usr/local/sbin/keepalived /sbin/

To install ipvs:

cd  tools/ipvsadm
 There is a Makefile in the directory, so make it directly
make install

Installation complete!
ipvsadm -L can see that the maximum number of connections to VS has changed
ipvsadm – help can see four modes supporting LVS

Tags: RPM yum vim Linux

Posted on Mon, 04 May 2020 02:45:52 -0400 by wutanggrenade