lvs的一些

lsmod |grep ip_vs
uname -r
ln -s /usr/src/kernels/2.6.18-164.el5-xen-x86_64/ /usr/src/linux

wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.24.tar.gz
tar zxvf ipvsadm-1.24.tar.gz
make all && make install

lvs

/etc/init.d/lvsDR

!/bin/sh

description: Start LVS of Director server

VIP=192.168.85.9
RIP1=192.168.85.32
RIP2=192.168.85.250
./etc/rc.d/init.d/functions
case “$1” in

start)
    echo " start LVS of Director Server"

set the Virtual IP Address and sysctl parameter

/sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 up

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

Clear IPVS table

   /sbin/ipvsadm -C

set LVS

/sbin/ipvsadm -A -t $VIP:81 -s rr #-p 600
/sbin/ipvsadm -a -t $VIP:81 -r $RIP1:8888 -g
/sbin/ipvsadm -a -t $VIP:81 -r $RIP2:8888 -g

Run LVS

  /sbin/ipvsadm
   ;;
stop)
    echo "close LVS Directorserver"
    echo "0" >/proc/sys/net/ipv4/ip_forward
    /sbin/ipvsadm -C
    /sbin/ifconfig eth0:0 down
    ;;
*)
    echo "Usage: $0 {start|stop}"
    exit 1

esac

service lvsDR start/stop

(web)

!/bin/bash

vip=192.168.85.191
/sbin/ifconfig lo:0 $vip broadcast $vip netmask 255.255.255.255 up
/sbin/route add -host $vip dev lo:0
echo “1” >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo “2” >/proc/sys/net/ipv4/conf/lo/arp_announce
echo “1” >/proc/sys/net/ipv4/conf/all/arp_ignore
echo “2” >/proc/sys/net/ipv4/conf/all/arp_announce

sysctl -p

你可能感兴趣的:(lvs的一些)