Director:
配置网卡:
配置eth0的ip用以跟其他的realserver通信
#ifconfig eth0 192.168.3.1 netmask 255.255.255.0 up
配置eth0的别名,并将VIP配置上
#ifconfig eth0:1 192.168.3.100 broadcast 192.168.3.100 netmask 255.255.255.255 up
打开路由转发功能:
#echo 1 > /proc/sys/net/ipv4/ip_forward
配置ipvs规则:
#ipvsadm -A -t 192.168.3.100:80 -s wlc
#ipvsadm -a -t
192.168.3.100:80 -r 192.168.3.10 -w 1
#ipvsadm -a -t 192.168.3.100:80 -r 192.168.3.20 -w 5
#ipvsadm -a -t 192.168.3.100:80 -r 192.168.3.30 -w 10
查看ipvs规则:
#ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.3.100:80 wlc
-> 192.168.3.30:80 Route 10 0 0
-> 192.168.3.20:80 Route 5 0 0
-> 192.168.3.10:80 Route 1 0 0
Realserver:
配置网卡:
配置eth0的ip用以跟Director通信
#vim ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
NETMASK=255.255.255.0
IPADDR=192.168.3.10
GATWAY=192.168.3.1
ONBOOT=yes
配置lo的别名,并将VIP配置上,当realserver返回数据时将其作为源地址
#vim ifcfg-lo:1
DEVICE=lo:1
IPADDR=192.168.3.100
NETMASK=255.255.255.255
BROADCAST=192.168.3.100
ONBOOT=yes
添加路由信息,配置到VIP的数据都从lo:1出去:
#vim /etc/sysconfig/static-routes
any host 192.168.3.100 dev lo:1
设置ip_ignore和ip_annouce参数
#vim /etc/sysctl.conf
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
阅读(1312) | 评论(0) | 转发(0) |