dip:192.168.199.230
vip:192.168.199.235
rip:192.168.199.231 (232)
Load Balancer:
[root@lvs001 ~]# sysctl-w net.ipv4.ip_forward=0
Net.ipv4.ip_forward = 0
[root@lvs001 ~]# ifconfig eth1:1 192.168.199.235 netmask up
[root@lvs001 ~]# ipvsadm-a-t 192.168.199.235:80-s wrr-p 20
[root@lvs001 ~]# ipvsadm-a-T 192.168.199.235:80-r 192.168.199.232:80-i-W 1
[root@lvs001 ~]# ipvsadm-a-T 192.168.199.235:80-r 192.168.199.231:80-i-W 1
Real-server:
[root@realserver001 ~]#/sbin/modprobe Ipip
[root@realserver001 ~]# Modinfo Tun #确认内核是否有tun模块
FileName:/lib/modules/2.6.32-358.el6.x86_64/kernel/drivers/net/tun.ko
alias:char-major-10-200
License:gpl
Author: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
Description:universal Tun/tap Device Driver
Srcversion:b81d2a0effdd495b07c94ab
Depends:
vermagic:2.6.32-358.el6.x86_64 SMP mod_unload modversions
[root@realserver001 ~]# Modprobe Tun #加载内核模块
[Root@realserver001 ~]# Lsmod | grep Tun
Tun 17031 0
Tunnel4 2943 1 Ipip
[root@realserver001 ~]# ifconfig tunl0 192.168.199.235 netmask 255.255.255.255 broadcast 192.168.199.235
[root@realserver001 ~]# ifconfig tunl0 up
[root@realserver001 ~]# Route add-host 192.168.199.235 Dev tunl0
[Root@realserver001 ~]# echo "2" >/proc/sys/net/ipv4/conf/tunl0/arp_announce
[Root@realserver001 ~]# echo "1" >/proc/sys/net/ipv4/conf/tunl0/arp_ignore
[root@realserver001 ~]# echo "0" >/proc/sys/net/ipv4/conf/tunl0/rp_filter
[Root@realserver001 ~]# echo "1" >/proc/sys/net/ipv4/conf/tunl0/forwarding
[Root@realserver001 ~]# echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
[Root@realserver001 ~]# echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
Possible error:
[root@realserver001 ~]# ifconfig tun10 192.168.199.235 broadcast 192.168.199.235 netmask 255.255.255.255 up
Siocsifaddr:no such device
Tun10:unknown Interface:no such device
Siocsifbrdaddr:no such device
Tun10:unknown Interface:no such device
Siocsifnetmask:no such device
Tun10:unknown Interface:no such device