lvs 配置中 虚拟地址的是如何设定的?
三台机器 210.51.28.77 210.51.28.75 210.51.28.78
想配置 77 为lb 75 78 为rs
--下面是我安装的过程
安装过程:
在77上
1 准备,检查工作:
#确认尚未安装lvs
#smod |grep ip_vs
#确认linux内核版本
#uname -r
2.6.9-42.ELsmp
2 下载,安装软件包
#创建安装目录
#mkdir /usr/local/src/lvs
#cd /usr/local/src/lvs
#下载软件
#wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.24.tar.gz
#解压缩
#tar -zxvf ipvsadm-1.24.tar.gz
#cd ipvsadm-1.24
#建立编译时必须的一个软链接
#ln -s /usr/src/kernels/2.6.9-42.EL-i686/ /usr/src/linux
#编译安装
#make && make install
#确认安装成功
#whereis ipvsadm
3 VS-DR,配置LVS脚本实现负载均衡
#vi /etc/init.d/lvsdr
#编辑脚本
#!/bin/bash
VIP=210.51.28.83 --这个是怎么设定的 计算机网络实在不熟悉
RIP1=210.51.28.75
RIP2=210.51.28.78
GW=210.51.28.1
# set the Virtual IP Address
/sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev eth0:0
echo "1" >/proc/sys/net/ipv4/ip_forward
#Clear IPVS table
/sbin/ipvsadm -C
#set LVS
/sbin/ipvsadm -A -t $VIP:80 -s rr
/sbin/ipvsadm -a -t $VIP:80 -r $RIP1:80 -g
/sbin/ipvsadm -a -t $VIP:80 -r $RIP2:80 -g
#Run LVS
/sbin/ipvsadm
#chmod 755 /etc/init.d/lvsdr
#service lvsdr start
在75 78 上
4 配置realserver
#vi /etc/init.d/lvsrs
#编辑脚本
#!/bin/bash
VIP=210.51.28.83
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev lo:0
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
sysctl -p
#end
#chmod 755 /etc/init.d/lvsrs
#service lvsrs start
5 确认安装成功
访问 http://210.51.28.83/
ipvsadm -lcn
IPVS connection entries
pro expire state source virtual destination
TCP 00:49 SYN_RECV 210.51.28.220:11065 210.51.28.83:80 210.51.28.78:80
TCP 00:49 SYN_RECV 210.51.28.220:11070 210.51.28.83:80 210.51.28.75:80
TCP 00:48 SYN_RECV 210.51.28.220:11061 210.51.28.83:80 210.51.28.75:80
SYN_RECV 应该是不成功的吧
我查看了 arp_announce等参数是修改成功的
就是虚拟地址不懂 我是就随便找了一个没有人用的83 写在那里的
这样是不是不对
下面是 77 的ip信息
ifconfig
eth0 Link encap:Ethernet HWaddr 00:1A:64:99:B1:14
inet addr:210.51.28.77 Bcast:210.51.28.255 Mask:255.255.255.0
inet6 addr: fe80::21a:64ff:fe99:b114/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:397631940 errors:0 dropped:0 overruns:0 frame:0
TX packets:367476520 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1088121400 (1.0 GiB) TX bytes:2870128856 (2.6 GiB)
Interrupt:209 Memory:c8000000-c8011100
eth0:0 Link encap:Ethernet HWaddr 00:1A:64:99:B1:14
inet addr:210.51.28.83 Bcast:210.51.28.83 Mask:255.255.255.255
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:209 Memory:c8000000-c8011100
eth1 Link encap:Ethernet HWaddr 00:1A:64:99:B1:16
inet addr:10.9.4.77 Bcast:10.9.4.255 Mask:255.255.255.0
inet6 addr: fe80::21a:64ff:fe99:b116/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:70977272 errors:0 dropped:0 overruns:0 frame:0
TX packets:97015778 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1926635011 (1.7 GiB) TX bytes:1138560333 (1.0 GiB)
Interrupt:169 Memory:ce000000-ce011100
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:383565320 errors:0 dropped:0 overruns:0 frame:0
TX packets:383565320 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3309766100 (3.0 GiB) TX bytes:3309766100 (3.0 GiB)
请前辈们指正下吧 谢谢
我msn h_devil@163.com 可以联系我讨论的
折腾了蛮久了 实在是新手啊~
hdevil
周五, 2009-04-03 07:51
Permalink
饿 网络配置错了
饿 网络配置错了 要是有一点网络知识就不会问这个了
最简易的配置是需要寻找三台主机: 一台双网卡的做master 两台做realsever
名称 IP
LVS-DR-Master Vip=210.51.28.77 ip=10.9.4.77
WEB1-Realserver 10.9.4.75
WEB2-Realserver 10.9.4..90
GateWay 10.9.4.77
z0800
周三, 2009-04-08 03:23
Permalink
"一台双网卡的做master
"一台双网卡的做master 两台做realsever",但这样会对master的I/O接口就必须高性能高带宽了(如果流量成几何增长)!
Anonymous (没有被验证)
周二, 2014-03-04 09:44
Permalink
awDYkbLYhfX
Thee'rs nothing like the relief of finding what you're looking for.
Anonymous (没有被验证)
周二, 2014-03-04 21:01
Permalink
FCCowKMfuCOXI
Yo, good looikn out! Gonna make it work now.
Anonymous (没有被验证)
周四, 2014-05-01 17:35
Permalink
ZRsTOpFcRvRRIlSCZZ
online car insurance rates cheap online car insurance quotes here cheapautoinsurancequotesllc.com cheap viagra generic best price
Anonymous (没有被验证)
周四, 2014-05-29 22:12
Permalink
uWrnwuZaTNOxMTsp
cheap auto insurance in florida write essay cheap homeowners insurance whole life insurance quotes
Anonymous (没有被验证)
周三, 2014-11-19 08:21
Permalink
jJVVpjUezlODIezf
buy cialis online buy cialis generic discount viagra and cialis insurance quotes car free auto insurance