#!/bin/bash #lvs setting #DIP# eth0:192.168.233.145 #VIP# eth0:0 192.168.233.250/32 #RIP1:192.168.233.146 #RIP2:192.168.233.147 #VIP# 192.168.233.250/32 case $1 in rip) #VIP: iptables -F setenforce 0 echo 1 >/proc/sys/net/ipv4/conf/lo/arp_ignore echo 1 >/proc/sys/net/ipv4/conf/all/arp_ignore echo 2 >/proc/sys/net/ipv4/conf/lo/arp_announce echo 2 >/proc/sys/net/ipv4/conf/all/arp_announce ifconfig lo:0 192.168.233.250 netmask 255.255.255.255 broadcast 192.168.233.250 up route add -host 192.168.233.250 dev lo:0 ;; dip) #DIP: iptables -F setenforce 0 echo 1 >/proc/sys/net/ipv4/ip_forward ifconfig eth0:0 192.168.233.250 netmask 255.255.255.255 broadcast 192.168.233.250 up ipvsadm -C ipvsadm -A -t 192.168.233.250:80 -s wlc ipvsadm -a -t 192.168.233.250:80 -r 192.168.233.146 -g ipvsadm -a -t 192.168.233.250:80 -r 192.168.233.147 -g ipvsadm -Ln ;; esac #End#