[root@lvs boot]# lsmod Module Size Used by Not tainted parport_pc 19204 1 (autoclean) lp 9188 0 (autoclean) parport 39072 1 (autoclean) [parport_pc lp] autofs 13684 0 (autoclean) (unused) pcnet32 18592 3 mii 4124 0 [pcnet32] keybdev 2976 0 (unused) mousedev 5656 0 (unused) hid 22308 0 (unused) input 6208 0 [keybdev mousedev hid] usb-uhci 27404 0 (unused) usbcore 82592 1 [hid usb-uhci] ext3 73376 2 jbd 56336 2 [ext3] BusLogic 100988 3 sd_mod 13452 6 scsi_mod 110488 2 [BusLogic sd_mod]
real 86m15.963s
user 44m29.660s
sys 36m52.840s
echo "1" > /proc/sys/net/ipv4/ip_forward
# clear ipvsadm tables
/sbin/ipvsadm -C
#install LVS remove and reinstall ip_vs.o and ip_vs_wlc.o modules
/sbin/rmmod ip_vs
/sbin/rmmod ip_vs_wlc
/sbin/rmmod ip_vs_wrr
/sbin/insmod ip_vs.o
/sbin/insmod ip_vs_wlc.o
#add http to VIP with wlc sheduling
/sbin/ipvsadm -A -t 128.198.61.61:http -s wlc
#first realserver
#forward http to realserver 192.168.2.111 using LVS-NAT (-m), with weight=1
/sbin/ipvsadm -a -t 128.198.61.61:http -r 192.168.2.111:http -m -w 2
#check that realserver is reachable from director
ping -c 1 192.168.2.53
#second realserver
#forward http to realserver 192.168.1.12 using LVS-NAT (-m), with weight=1
/sbin/ipvsadm -a -t 128.198.61.50:http -r 192.168.2.55:http -m -w 1
#checking if realserver is reachable from director
ping -c 1 192.168.2.55
#list ipvsadm table
/sbin/ipvsadm
The ping commands are there to make sure the real server is up.
When ./natwlc.sh is executed in that directory, we got
[root@lvsnat lvs]# ./natwlc.sh
rmmod: module ip_vs_wlc is not loaded
rmmod: module ip_vs_wrr is not loaded
PING 192.168.2.111 (192.168.2.111) 56(84) bytes of data.
64 bytes from 192.168.2.111: icmp_seq=1 ttl=64 time=3.25 ms--- 192.168.2.111 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 3.258/3.258/3.258/0.000 ms
PING 192.168.2.112 (192.168.2.112) 56(84) bytes of data.
64 bytes from 192.168.2.112: icmp_seq=1 ttl=64 time=3.02 ms--- 192.168.2.112 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 3.029/3.029/3.029/0.000 ms
IP Virtual Server version 1.0.10 (size=65536)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 128.198.61.61:http wlc
-> 192.168.2.112:http Masq 1 0 0
-> 192.168.2.111:http Masq 2 0 0