Get source code from www.kernel.org.
Then do :
#cp linux-2.4.18.tar.gz /usr/src
#cp patch-2.4.18.gz /usr/src
#cp ipvs-1.0.2.tar.gz /usr/src
#cd /usr/src
#rm ?Cfr linux
#tar ?Czxvf linux-2.4.18.tar.gz
#mv linux linux-2.4.18
#ls ?Cs linux-2.4.18 linux
#tar ?Czxvf ipvs-1.0.2.tar.gz
##gzip ?Cd patch-2.4.18.gz
##patch ?Cp0 <patch-2.4.18
#cd /usr/include
#rm ?Cfr asm scsi linux
#ln -s /usr/src/linux/include/asm-i386/ asm
#ln -s /usr/src/linux/include/linux linux
#ln -s /usr/src/linux/include/scsi scsi
IPVS Patch
#cd /usr/src/linux
#cat ../ipvs-1.0.2/linux_kernel_ksyms_c.diff | patch -p1
#cat ../ipvs-1.0.2/linux_net_netsyms_c.diff | patch -p1
#cat ../ipvs-1.0.2/linux_net_Makefile.diff | patch -p1
#cat ../ipvs-1.0.2/linux_net_ipv4_Config_in.diff | patch -p1
#cat ../ipvs-1.0.2/linux_ip_fw_compat_c.diff | patch -p1
#cp -rp ../ipvs-1.0.2/ipvs net/ipv4
#mv net/ipv4/ipvs/linux_net_ipv4_ipvs_Makefile net/ipv4/ipvs/Makefile
#make menuconfig
Kernel Compile Options:
Code maturity level options --->
[*] Prompt for development and/or incomplete code/drivers
Networking options --->
[*] Network packet filtering (replaces ipchains)
[ ] Network packet filtering debugging
...
IP: Netfilter Configuration --->
IP: Virtual Server Configuration --->
<M> virtual server support (EXPERIMENTAL)
[*] IP virtual server debugging
(12) IPVS connection table size (the Nth power of 2)
--- IPVS scheduler
<M> round-robin scheduling
<M> weighted round-robin scheduling
<M> least-connection scheduling scheduling
<M> weighted least-connection scheduling
<M> locality-based least-connection scheduling
<M> locality-based least-connection with replication scheduling
<M> destination hashing scheduling
<M> source hashing scheduling
--- IPVS application helper
<M> FTP protocol helper
#make dep
#make bzImage
#make modules
#make modules_install
#reboot your new kernel
#cd /usr/src/ipvs-1.0.2/ipvs
#make
#make -C ipvsadm
#cd ipvsadm
#make install
#su
#make install
#insmod ip_vs.o
#insmod ip_vs_wlc.o
Dispatcher
#######ifconfig eth0:0 <VIP> netmask 255.255.255.255 broadcast <VIP> up
#ifconfig eth0:0 192.168.1.250 netmask 255.255.255.0 broadcast
192.168.1.255 up
#ipvsadm ?CA ?Ct 192.168.1.250:* -s wlc -p
ipvsadm -a -t 192.168.1.250:0 -r 192.168.1.51 -g
ipvsadm -a -t 192.168.1.250:0 -r 192.168.1.52 -g
Real Server
#ifconfig lo:0 192.168.1.250 netmask 255.255.255.255 broadcast
192.168.1.250 up
#route add -host 192.168.1.250 dev lo:0
Enjoy it!
|