VS/DR: That is, Virtual Server via Direct Routing
That is, using direct routing technology to implement virtual server. Its connection scheduling and management is the same as in Vs/nat and Vs/tun, but its message forwarding method is different, vs/dr by overwriting the request message MAC address, send the request to real server, and real server will respond directly back to the customer, eliminates the vs/ The IP tunneling overhead in the Tun. This is the best performance in three load scheduling mechanisms, but requires that both Director server and real server have a single network card connected to the same physical network segment.
Example
dip:172.28.95.220
vip:172.28.95.245
rip:172.28.95.221 (222)
Load Scheduler:
[root@lvs-gs001 ipvsadm-1.24]# ifconfig eth1:1 172.28.95.245 netmask up
[Root@lvs-gs001 ipvsadm-1.24]# Ifconfig
eth1 Link encap:ethernet hwaddr 00:15:5d:c7:83:7d
inet addr:172.28.95.220 bcast:172.28.95.255 mask:255.255.240.0
Eth1:1 Link encap:ethernet hwaddr 00:15:5d:c7:83:7d
inet addr:172.28.95.245 bcast:172.28.95.255 mask:255.255.255.0
Up broadcast RUNNING multicast mtu:1500 metric:1
Interrupt:9 Base address:0xc000
[Root@lvs-gs001 ipvsadm-1.24]# Ipvsadm
IP Virtual Server version 1.2.1 (size=4096)
Prot Localaddress:port Scheduler Flags
-> remoteaddress:port Forward Weight activeconn inactconn
[root@lvs-gs001 ipvsadm-1.24]# Ipvsadm--help
[root@lvs-gs001 ipvsadm-1.24]# ipvsadm--set 5 #--set TCP tcpfin UDP set connection timeout values
[root@lvs-gs001 ipvsadm-1.24]# ipvsadm-a-t 172.28.95.245:80-s wrr-p add virtual service with options #-s Scheduler One of rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq,the default scheduler is WLC.
[root@lvs-gs001 ipvsadm-1.24]# ipvsadm-l-N
IP Virtual Server version 1.2.1 (size=4096)
Prot Localaddress:port Scheduler Flags
-> remoteaddress:port Forward Weight activeconn inactconn
TCP 172.28.95.245:80 WRR Persistent 20
[root@lvs-gs001 ipvsadm-1.24]# ipvsadm-a-T 172.28.95.245:80-r 172.28.95.221:80-g-W 1
[root@lvs-gs001 ipvsadm-1.24]# ipvsadm-a-T 172.28.95.245:80-r 172.28.95.222:80-g-W 1
[root@lvs-gs001 ipvsadm-1.24]# ipvsadm-l-N
IP Virtual Server version 1.2.1 (size=4096)
Prot Localaddress:port Scheduler Flags
-> remoteaddress:port Forward Weight activeconn inactconn
TCP 172.28.95.245:80 WRR Persistent 20
-> 172.28.95.222:80 Route 1 0 0
-> 172.28.95.221:80 Route 1 0 0
Real-server:
[root@realserver001 ~]# ifconfig lo:221 172.28.95.245:80 netmask up
[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