LVS-DR配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LVS-DR配置相关的知识,希望对你有一定的参考价值。
LVS/DR 配置
三台机器:
director(eth0192.168.31.166, vip eth0:0:192.168.31.110)
real server1(eth0 rip: 192.168. 31.100, viplo:0: 192.168.31.110)
real server2(eth0 rip: 192.168.31.101, viplo:0: 192.168.31.110)
Director 上 vim/usr/local/sbin/lvs_dr.sh
//增加
#! /bin/bash
echo 1 > /proc/sys/net/ipv4/ip_forward
ipv=/sbin/ipvsadm
vip=192.168.31.110
rs1=192.168.31.100
rs2=192.168.31.101
ifconfig eth0:0 $vip broadcast $vip netmask255.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
两台rs上:
vim /usr/local/sbin/lvs_dr_rs.sh
#! /bin/bash
vip=192.168.31.110
ifconfig lo:0 $vip broadcast $vip netmask255.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
然后director上执行: bash /usr/local/sbin/lvs_dr.sh
两台rs上执行: bash /usr/local/sbin/lvs_dr_rs.sh
Windows下浏览器测试访问
本文出自 “Linux” 博客,请务必保留此出处http://syklinux.blog.51cto.com/9631548/1741457
以上是关于LVS-DR配置的主要内容,如果未能解决你的问题,请参考以下文章