- 论坛徽章:
- 0
|
本帖最后由 selfthing 于 2012-03-08 18:24 编辑
一、环境:
局域网服务器IP:
10.10.23.247,10.10.23.248
外网服务器IP:
218.30.103.5
局域网用虚IP:
10.10.23.252
218.30.103.5是10.10.23.248的备份。
二、目标:
10.10.23.248和218.30.103.5设置为主备的方式,当23.248没宕机时,局域网用户通过虚IP10.10.23.252的31777端口访问rsync服务,实际连的是23.248,当23.248宕机,访问23.252时lvsi自动切换为访问218.30.103.5.
三、配置
(我只在247上配置了对31777的转发,看转发能否成功)
10.10.23.247的配置如下:
ifconfig tunl0 10.10.23.252 broadcast 10.10.23.252 netmask 255.255.255.255 up
route add -host 10.10.23.252 dev tunl0
ipvsadm -A -t 10.10.23.252:31777
ipvsadm -a -t 10.10.23.252:31777 -r 218.30.103.5 -i
echo "0" >/proc/sys/net/ipv4/ip_forward
echo "1" >/proc/sys/net/ipv4/conf/all/send_redirects
echo "1" >/proc/sys/net/ipv4/conf/default/send_redirects
echo "1" >/proc/sys/net/ipv4/conf/eth0/send_redirects
执行ipvsadm -ln显示如下:
TCP 10.10.23.252:31777 wlc
-> 218.30.103.5:31777 Tunnel 1 0 0
218.30.103.5的配置如下:
ifconfig tunl0 10.10.23.252 broadcast 10.10.23.252 netmask 255.255.255.255 up
route add -host 10.10.23.252 dev tunl0
echo "0" >/proc/sys/net/ipv4/ip_forward
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
echo "0" > /proc/sys/net/ipv4/conf/tunl0/rp_filter
echo "0" > /proc/sys/net/ipv4/conf/all/rp_filter
设置好后在局域网telnet 10.10.23.252 31777 始终不通,百思不得其解,求教各位,看我哪里设置的有问题。
(同样的设置我在局域网的几台服务器上可以通过。) |
|