ipvsadm installation configuration NAT

installation:

1, yum install

yum install -y ipvsadm

2, package installation

tar package and the same general rpm package and installation. Note, however, installation requires that the kernel and the kernel consistent corresponding server. After the new version has optimized versions for different applications.

3, after installation, to confirm

ipvsadm --version
yum list installed | grep ipvsadm

Configuration:

Add the appropriate firewall ports to allow access. In turn off the firewall or empty firewall rules

service network stop
systemctl stop network
iptables -F

Clear ipvsadm table:

echo 1 >/proc/sys/net/ipv4/ip_forward

NAT mode settings:

# LVS- Clear all Server records the schedule of 
the ipvsadm - C 
# conversions table with a scheduling algorithm, - RR wheel mode called 
the ipvsadm -At 8.8 . 8.8 : 80 - S RR 
# increase the round-robin servers - m NAT mode 
the ipvsadm -at 8.8 . 8.8 : 80 -R & lt 192.168 . 10.2 : 80 -m - W  . 1 
the ipvsadm -at 8.8 . 8.8 : 80 -R & lt 192.168 . 10.3 : 80 -m -w 1

Back-end servers:

Start the service; confirmation service port listens on 0.0.0.0 or VIP, and then set the real vip

# Set ip forwarding
 echo  0 > / proc / SYSY / NET / ipv4 / ip_forward 

Set VIP
 / sbin / ifconfig eth0 up
 / sbin / ifconfig eth0 8.8 . 8.8 Broadcast 8.8 . 8.8 Netmask 255.255 . 255.255 up 

# avoid arp broadcast problems 
echo  1 > / proc / SYSY / NET / IPv4 / the conf / eth0 / arp_ignore
 echo  2 > / proc / SYSY / NET / IPv4 / the conf / eth0 / arp_announce
 echo  . 1 > / proc / SYSY / NET / IPv4 / the conf / All / arp_ignore
 echo  2> / Proc / SYSY / NET / ipv4 / conf / All / arp_announce 

# Set routing
 / sbin / route the Add -host 8.8 . 8.8 dev eth0

Close arp broadcast request, to prevent multiple machines in response that he is VIP

 

Guess you like

Origin www.cnblogs.com/lw-2019forlinuxpython/p/12557962.html