I. preparations:
1. VMWare workstaion 5.0 can install three Linux instances on Windows. You don't need it if you have multiple PCs.
VMware 5.0 serial number, always has one for you
-------------- For reference only !!!
For Windows:
6a8j6-ftjm7-l8q15-48h98
WC9WN-N2U0G-804FG-4M8N6
E2EU9-XYV26-Z2NFA-4Y9N3
XLWPN-W476D-68NDF-5PTX3
X24FW-90T4M-H8H6C-4MDX7
6a8l6-f2tqj-le7dp-4t1v0
KJWPN-FKT48-505FK-4RHL0
60evk-fv5pk-l42f6-4khud
T2405-V27DD-A8M6A-4WXQK
ELH4M-66LFV-D81DA-4PRXP
68t4x-whkde-8a0fa-4ywz2
H2EMX-L0H8D-42MDA-4YWXL
R21PR-FWJAC-F00DU-4YRQ7
TR1YE-5HMDW-90H4G-4M8X6
2. centos 4.4 (it is RedHat Linux 4 full source code recompilation
, Free upgrades, great)
Download
: Http://isoredirect.centos.org/centos/4/isos/i386/
Download 1, 2, 3, and 4. ISO files.
3. ipvsadm-1.24.tar.gz
Http://www.linuxvirtualserver.org/software/ipvs.html
Ii. Start installation:
1. Install centos 4.4 in VMware.
I chose xwindows system, GNOME desktop environment,
Kde k desktop environment, development tools, X software development,
Gnome software development, Kde software development. Web
Server.
2. Copy the Operating System
. Generate the second and third Operating Systems
.
3. The IP addresses of the three operating systems are:
(LVS
Server) 192.168.1.231
255.255.255.0
192.168.1.1 (GW)
(Real Server) 192.168.1.20.
255.255.255.0
192.168.1.1 (GW)
(Real Server) 192.168.1.233
255.255.255.0
192.168.1.1 (GW)
4. Go to 192.168.1.231 and check that the kernel contains the ipvs module.
Modprobe-L | grep ipvs
If you see the following, You Can recompile the kernel if not.
, Re-compile the ipvs module.
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_wlc.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_dh.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_sed.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_wrr.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_lc.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_rr.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_nq.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_lblcr.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_ftp.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_sh.ko
/Lib/modules/2.6.9-42.el/ kernel/NET/IPv4/ipvs/ip_vs_lblc.ko
5. Enter 192.168.1.231 to install the ipvsadm-1.24.tar.gz, other real servers do not need to install this software
# Cd/usr/src/
# Ln-s kernels/2.6.9-42. EL-i386 Linux // If the make execution below this link does not have errors
# Tar xzf ipvsadm-1.24.tar.gz
# Cd ipvsadm-1.24
# Make
# Make install
# Ipvsadm -- help if the prompt is displayed
The help indicates that the table is successful.
# Chkconfig httpd on
# Service httpd start // start HTTP
6. Enter 192.168.1.231
# Ifconfig eth0: 0 192.168.1.230 netmask 255.255.255.255 broadcast 192.168.1.230 up
// Configure the virtual IP address 192.168.1.230, which is the IP address that provides the external HTTP service.
# Echo 1>/proc/sys/NET/IPv4/ip_forward // enable IP Forwarding
# Ipvsadm-a-t 192.168.1.230: 80-s wlc // Add virtual service
# Ipvsadm-a-t 192.168.1.230: 80-r 192.168.1.20.- g // Add Real Server
# Ipvsadm-a-t 192.168.1.230: 80-r 192.168.1.233-G // Add Real Server
Write the above five sentences at the end of/etc/rc. Local to avoid entering them after restart.
Ipvsadm-L is a list.
Ipvsadm-D-T 192.168.1.230: 80-r 192.168.1.233 // Yes Delete Real Server 192.168.1.233
7. Enter 192.168.1.20.
Add the following four sentences to the/etc/sysctl. conf file:
Finally:
Net. ipv4.conf. Lo. arp_ignore = 1
Net. ipv4.conf. Lo. arp_announce = 2
Net. ipv4.conf. All. arp_ignore = 1
Net. ipv4.conf. All. arp_announce = 2
// Disable ARP
# Ifconfig lo: 0 192.168.1.230 netmask 255.255.255.255 broadcast 192.168.1.230 up
# Route add-host 192.168.1.230 Dev lo: 0
Write the above two sentences at the end of/etc/rc. Local to avoid restarting and then entering.
# Echo 'The site is 192.168.1.20.'>/var/www/html/index.html
# Chkconfig httpd on
# Service httpd start
8. Enter 192.168.1.233
Add the following four sentences to the end of the/etc/sysctl. conf file:
Net. ipv4.conf. Lo. arp_ignore = 1
Net. ipv4.conf. Lo. arp_announce = 2
Net. ipv4.conf. All. arp_ignore = 1
Net. ipv4.conf. All. arp_announce = 2
// Disable ARP
# Ifconfig lo: 0 192.168.1.230 netmask 255.255.255.255 broadcast 192.168.1.230 up
# Route add-host 192.168.1.230 Dev lo: 0
Write the above two sentences at the end of/etc/rc. Local to avoid restarting and then entering.
# Echo 'The site is 192.168.1.233 '>/var/www/html/index.html
# Chkconfig httpd on
# Service httpd start
Iii. test:
1. Access http: // 192.168.1.230 on another PC
Refresh the browser constantly. If you see different pages, it means it is successful,
Some browsers may need to clear the cache. If not,
Wait for a while before closing. Open your browser and try again.
Http://leftleg.hzpub.com/post/612/