To save public IP addresses, the VIP address in the DR model can be a public IP address. RIP points all gateways to the same vro using an intranet IP address to achieve LVS load balancing in the DR model.
The experiment extension diagram is as follows:
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0424144V1-0.jpg "title =" LVS_DR.jpg "alt =" 140437815.jpg"/>
1) simulate the environment
192.168.1.X is simulated as the Internet, and 172.16.0.X is simulated as the Intranet.
Client (Gateway ):
Eth0: 192.168.1.15Host-Only)
Eth1: 172.16.0.13Host-Only)
Director:
VIP: 192.168.1.10eth0: 0)
Gateway: 172.16.0.13
DIP: 172.16.0.8eth0, Host-Only)
RS1:
RIP: 172.16.0.11eth0, Host-Only)
Gateway: 172.16.0.13
VIP: 192.168.1.10lo: 0)
Build web Services:
# echo “RS1.ikki.com” > /var/www/html/index.html# curl http://172.16.0.11/index.html
RS2:
RIP: 172.16.0.12eth0, Host-Only)
Gateway: 172.16.0.13
VIP: 192.168.1.10lo: 0)
Build web Services:
# echo “RS2.ikki.com” > /var/www/html/index.html# curl http://172.16.0.12/index.html
2) Configure RS1 and RS2
# echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore# echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce# echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce# ifconfig lo:0 192.168.1.10 netmask 255.255.255.255 broadcast 192.168.1.10# route add -host 192.168.1.10 dev lo:0
3) configure the ipvs Service
Director:
# ifconfig eth0:0 192.168.1.10 netmask 255.255.255.0 up# echo 1 > /proc/sys/net/ipv4/ip_forward# ipvsadm -C# ipvsadm -A -t 192.168.1.10:80 -s rr# ipvsadm -a -t 192.168.1.10:80 -r 192.168.1.11 -g# ipvsadm -a -t 192.168.1.10:80 -r 192.168.1.12 -g
4) test
Client: Test Access:
# curl http://192.168.1.10/index.html
Director: view the Load Status:
# ipvsadm -L -nIP Virtual Server version 1.2.1 (size=4096)Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConnTCP 192.168.1.10:80 rr -> 172.16.0.12:80 Route 1 0 4 -> 172.16.0.11:80 Route 1 0 5
This article from the "Don't dead birds a Hui" blog, please be sure to keep this source http://phenixikki.blog.51cto.com/7572938/1304142