安裝記錄for kernel 2.4.18
Front End (前端):
Need files: (可在linux virtual server網站取得)
1. hidden
2. ipvs-patch
3. ipvsadm
Steps:
# cd /usr/src/linux
# patch -p1 < hidden... (其實front end可以不用安裝這個patch)
# patch -p1 < ipvs-patch...
# rpm -ivh ipvsadm1.21-1.src.rpm
# cd /usr/src/redhat/source
# tar -zxvf ipvsadm....
# make install
=> 編譯核心: make clean; make dep; make bzImage; make modules; make modules_install (記得要把LVS選起來)
Real End(後端):
Need files:
1. hidden..
# cd /usr/src/linux
# patch -p1 < hidden...
=> 一樣編譯核心
Then...
後端記得要開httpd ,前端不開
前端的設定檔:
#!/bin/bash
#---------------mini-rc.lvs_dr-director------------------------
#set ip_forward OFF for vs-dr director (1 on, 0 off)
#cat /proc/sys/net/ipv4/ip_forward
echo "0" >/proc/sys/net/ipv4/ip_forward
#director is not gw for realservers: leave icmp redirects on
#echo 'setting icmp redirects (1 on, 0 off) '
echo "1" >/proc/sys/net/ipv4/conf/all/send_redirects
#cat /proc/sys/net/ipv4/conf/all/send_redirects
echo "1" >/proc/sys/net/ipv4/conf/default/send_redirects
#cat /proc/sys/net/ipv4/conf/default/send_redirects
echo "1" >/proc/sys/net/ipv4/conf/eth0/send_redirects
#cat /proc/sys/net/ipv4/conf/eth0/send_redirects
#add ethernet device and routing for VIP 192.168.1.110
ifconfig eth0:110 192.168.80.110 broadcast 192.168.80.110 netmask 255.255.255.255
/sbin/route add -host 192.168.80.110 dev eth0:110
#listing ifconfig info for VIP 192.168.1.110
/sbin/ifconfig eth0:110
#check VIP 192.168.1.110 is reachable from self (director)
#/bin/ping -c 1 192.168.1.110
#listing routing info for VIP 192.168.1.110
/bin/netstat -rn
#setup_ipvsadm_table
#clear ipvsadm table
/sbin/ipvsadm -C
#installing LVS services with ipvsadm
#add telnet to VIP with round robin scheduling
/sbin/ipvsadm -A -t 192.168.80.110:http -s wrr
#forward telnet to realserver using direct routing with weight 1
/sbin/ipvsadm -a -t 192.168.80.110:http -r 192.168.80.62 -g -w 1
/sbin/ipvsadm -a -t 192.168.80.110:http -r 192.168.80.61 -g -w 1
#check realserver reachable from director
#ping -c 1 192.168.1.12
#forward telnet to realserver using direct routing with weight 1
#/sbin/ipvsadm -a -t 192.168.1.110:http -r 192.168.1.12 -g -w 1
#check realserver reachable from director
#ping -c 1 192.168.1.12
#displaying ipvsadm settings
/sbin/ipvsadm
#not installing a default gw for LVS_TYPE vs-dr
#---------------mini-rc.lvs_dr-director------------------------
後端設定檔:
#!/bin/bash
#----------mini-rc.lvs_dr-realserver------------------
#installing default gw 192.168.1.254 for vs-dr
#/sbin/route add default gw 192.168.1.254
#showing routing table
#/bin/netstat -rn
#checking if DEFAULT_GW 192.168.1.254 is reachable
#ping -c 1 192.168.1.254
#set_realserver_ip_forwarding to OFF (1 on, 0 off).
echo "0" >/proc/sys/net/ipv4/ip_forward
#cat /proc/sys/net/ipv4/ip_forward
#looking for DIP 192.168.1.9
#ping -c 1 192.168.1.9
#looking for VIP (will be on director)
#ping -c 1 192.168.1.110
#install_realserver_vip
/sbin/ifconfig lo:110 192.168.80.110 broadcast 192.168.80.110 netmask 0xffffffff up
#ifconfig output
/sbin/ifconfig lo:110
#installing route for VIP 192.168.80.110 on device lo:110
/sbin/route add -host 192.168.80.110 dev lo:110
#listing routing info for VIP 192.168.80.110
/bin/netstat -rn
#hiding interface lo:110, will not arp
echo "1" >/proc/sys/net/ipv4/conf/all/hidden
#cat /proc/sys/net/ipv4/conf/all/hidden
echo "1" >/proc/sys/net/ipv4/conf/lo/hidden
#cat /proc/sys/net/ipv4/conf/lo/hidden
#----------mini-rc.lvs_dr-realserver------------------
