lvs的DR设置

回复 收藏
三台实验环境极其均为一块网卡
dir服务器配置
vim /usr/local/sbin/lvs-dr.sh
#! /bin/bash
echo 1 > /proc/sys/net/ipv4/ip_forward
ipv=/sbin/ipvsadm
vip=192.168.238.100
rs1=192.168.238.132
rs2=192.168.238.133
ifconfig eth0:0 $vip broadcast $vip netmask 255.255.255.255 up
route add -host $vip dev eth0:0
$ipv -C
$ipv -A -t $vip:80 -s rr
$ipv -a -t $vip:80 -r $rs1:80 -g -w 1
$ipv -a -t $vip:80 -r $rs2:80 -g -w 1
sh /usr/local/sbin/lvs_dr.sh
sr1服务器配置
vim /usr/local/sbin/lvr-sr.sh
#! /bin/bash
vip=192.168.238.100
ifconfig lo:0 $vip broadcast $vip netmask 255.255.255.255 up
route add -host $vip 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
sh /usr/local/sbin/lvs_rs.sh
sr2服务器配置
vim /usr/local/sbin/lvr-sr.sh
#! /bin/bash
vip=192.168.238.100
ifconfig lo:0 $vip broadcast $vip netmask 255.255.255.255 up
route add -host $vip 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
sh /usr/local/sbin/lvs_rs.sh
测试客户端访问

1432319102.jpg

2016-08-16 15:39 举报
已邀请:

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: