Vs/nat: that is, Virtual Server via network address translation
That is, network address translation technology to implement a virtual server, when the user requests to the scheduler, the dispatcher will request the message's destination address (that is, the virtual IP address) to the selected real server address, and the target port of the message is also changed to the corresponding port of the selected real server, Finally, the message request is sent to the selected real Server. After the server has obtained the data, real server returns the data to the user, needs again through the load dispatcher to change the source address and the source port of the message to the virtual IP address and the corresponding port, then sends the data to the user, completes the entire load dispatch process.
It can be seen that in the NAT mode, the user requests and response messages must be rewritten by Director server address, when the user requests more and more, the scheduler's processing ability will be called the bottleneck.
Example
dip:192.168.199.230
vip:192.168.1.235
rip:192.168.199.231 (232)
Load Balancer:
[root@lvs001 ~]# ifconfig eth1:1 192.168.1.235 netmask 255.255.255.0 up
[root@lvs001 ~]# ipvsadm--set 5
[root@lvs001 ~]# ipvsadm-a-t 192.168.1.235:80-s wrr-p
[root@lvs001 ~]# ipvsadm-a-T 192.168.1.235:80-r 192.16 8.199.232:80-m-W 1
[root@lvs001 ~]# ipvsadm-a-T 192.168.1.235:80-r 192.168.199.231:80-m-W 1
[root@LVS001 ~]# vim/etc/sysctl.conf
####################################################################################
Net.ipv4.ip_forward = 1
[root@lvs001 ~]# sysctl-w net.ipv4.ip_forward=1 #临时生效命令
######## ############################################################################
[root@LVS001 ~]# sysctl-p
Real-server:
[root@realserver001 ~]# route del default GW 192.168.199.1
[root@realserver001 ~]# route add default GW 192.168.199.230
[Root@realserver001 ~]# echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
[Root@realserver001 ~]# echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce
[Root@realserver001 ~]# echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
[Root@realserver001 ~]# echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
Points:
1: The dir must be separated from the VIP, or may appear on direct access to the cluster, the client can not, the link has been waiting for
2: The firewall must be closed, or it may ping, but the access times are not routed incorrectly