vmware workstation piranha ipvsadm TUN模式配置(未成功)

本文详细记录了在VMware Workstation环境下使用piranha和ipvsadm进行负载均衡配置的过程。涉及rhel5.4系统的配置步骤,包括安装必要软件包、启用内核转发、配置piranha及ipvsadm等关键环节。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

piranha ipvsadm 配置(未成功)

 

一.环境:

vmware workstation 7.0 RC

所有系统关闭iptables,禁用selinux

Server1.test.info(rhel5.4)

eth0:10.10.10.11/24(桥接到真实机网卡)

gateway:10.10.10.1


eth1:192.168.189.10/24 (host-only vmnet1)


Server2.test.info(rhel5.4)

eth0: 192.168.189.20/24 (host-only vmnet1)


Server3.test.info(rhel5.4)

eth0: 192.168.189.30/24 (host-only vmnet1)


 

 

二.配置:

Server1.test.info:

使用yum 安装以下包:  piranha,ipvsadm

启用转发:

vim /etc/sysctl.conf
将net.ipv4.ip_forward = 0 改为
net.ipv4.ip_forward = 1

保存退出..

执行:sysctl -p 立即生效

 

配置piranha

piranha-passwd 设置piranha密码

/etc/init.d/piranha-passwd start

 此时可以用http://10.10.10.11:3636 来访问piranha WEB配置界面.

 

也可以直接修改文件/etc/sysconfig/ha/lvs.cf

[root@server1 ~]# cat /etc/sysconfig/ha/lvs.cf
serial_no = 54
primary = 10.10.10.11
primary_private = 192.168.189.10
service = lvs
backup_active = 0
backup = 0.0.0.0
heartbeat = 1
heartbeat_port = 539
keepalive = 6
deadtime = 18
network = tunnel
debug_level = NONE
virtual server.test.info {
active = 1
address = 10.10.10.111 tunl0
vip_nmask = 255.255.255.255
port = 80
persistent = 600
send = "GET / HTTP/1.0\r\n\r\n"
expect = "HTTP"
use_regex = 0
load_monitor = none
scheduler = wlc
protocol = tcp
timeout = 6
reentry = 15
quiesce_server = 0
server server2.test.info {
address = 192.168.189.20
active = 1
port = 80
weight = 1
}
server server3.test.info {
address = 192.168.189.30
active = 1
port = 80
weight = 1
}
}

 

#/etc/init.d/piranha-gui restart

#/etc/init.d/pulse restart

#/etc/init.d/ipvsadm save

#/etc/init.d/ipvsadm start

 

 

Server2.test.info 配置;

cd /root
[root@server2 ~]# cat lvsRealServer.sh
#!/bin/bash
#Description : RealServer Start!
#Write by:iStone
#Last Modefiy:2007.12.15
VIP=10.10.10.111
/sbin/ifconfig tunl0 $VIP netmask 255.255.255.255 broadcast $VIP
/sbin/route add -host $VIP dev tunl0
echo "1" >/proc/sys/net/ipv4/conf/tunl0/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/tunl0/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

#echo "/root/lvsRealServer.sh" >> /etc/rc.d/rc.local

 #reboot

 

Server3.test.info 与Server2.test.info 同样配置...

 

 

Server1.test.info

[root@server1 ~]# ipvsadm
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  10.10.10.111:http wlc persistent 600
  -> 192.168.189.30:http          Tunnel  1      0          0
  -> 192.168.189.20:http          Tunnel  1      0          0

 

如果没有显示.把三台机子都重启一下.看看server2和server3的httpd服务有没有启动..

 

应该说是到了这里就可以成功了,用10.10.10.0/24段网络都能访问10.10.10.111了.但是我这里死活不成功..

 

 

不知道有没有 高人能帮我解答一下!!!

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值