一、安装:
1)环境:RHEL5.4 (eth0:192.168.100.100, eth1:218.196.96.131)
RS(Realserver eth0:192.168.100.101 and 192.168.100.102)
[root@puppet ~]# modprobe -l | grep ipvs
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_dh.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_ftp.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_lblc.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_lblcr.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_lc.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_nq.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_rr.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_sed.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_sh.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_wlc.ko
/lib/modules/2.6.18-164.el5/kernel/net/ipv4/ipvs/ip_vs_wrr.ko
2)下载安装编译:
[root@puppet ~]# wget
[root@puppet ~]# useradd -r wensong
[root@puppet ~]# rpm -ivh ipvsadm-1.24-6.src.rpm
1:ipvsadm ########################################### [100%]
[root@puppet ~]#cd /usr/src/redhat/SPECS/
[root@puppet SPECS]# ln -s /usr/src/kernels/2.6.18-164.el5-x86_64/ /usr/src/linux
[root@puppet SPECS]# rpmbuild -bb ipvsadm.spec
error: Legacy syntax is unsupported: copyright
error: line 7: Unknown tag: Copyright: GNU General Public Licence
&编辑:vi ipvsadm.spec
Copyright 修改为 License,重新编译OK
[root@puppet SPECS]# cd /usr/src/redhat/RPMS/x86_64
[root@puppet x86_64]# rpm -ivh ipvsadm-1.24-6.x86_64.rpm
Preparing... ########################################### [100%]
1:ipvsadm ########################################### [100%]
3)在Realserver上将默认网关设为调度器的eth0:
#/sbin/route add default gw 192.168.100.100
4)在LVS服务器上执行:
#echo 1 > /proc/sys/net/ipv4/ip_forward
#/sbin/ipvsadmin -C --清空配置
#/sbin/ipvsadmin -A -t 218.196.96.131:80 -s -rr --简单的轮询策略
#/sbin/ipvsadmin -a -t 218.196.96.131:80 -r 192.168.100.101:8080 -m --(-m)表示NAT模式 (-i) 隧道模式 (-g)路由模式
#/sbin/ipvsadmin -a -t 218.196.96.131:80 -r 192.168.100.102:8080 -m
#/sbin/ipvsadmin -L -n --查看LVS执行情况
LVS三种模式之间的对比:
阅读(2440) | 评论(0) | 转发(0) |