标签:
D. 响应报文从eth0出来后 交给的下一个 主机 ,那么 下个主机一定是 eth0(RIP)的网关。
对调整的内核参数解释:
Real Server 1:
[root@nod3 ~]# echo 1 > /proc/sys/net/ipv4/conf/lo/arp_ignore
[root@nod3 ~]# echo 2 > /proc/sys/net/ipv4/conf/lo/arp_announce
[root@nod3 ~]# echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
[root@nod3 ~]# echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
[root@nod3 ~]# ifconfig lo:0 192.168.195.150 broadcast 192.168.195.171 netmask 255.255.255.255 up
[root@nod3 ~]# route add -host 192.168.195.150 dev lo:0
[root@nod3 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.195.150 0.0.0.0 255.255.255.255 UH 0 0 0 lo
192.168.195.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 192.168.195.2 0.0.0.0 UG 0 0 0 eth0
[root@nod3 ~]# ifconfig eth0
Link encap:Ethernet HWaddr 00:0C:29:6F:42:49
inet addr:192.168.195.171 Bcast:192.168.195.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe6f:4249/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:746 errors:0 dropped:0 overruns:0 frame:0 TX packets:471 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:68969 (67.3 KiB) TX bytes:53295 (52.0 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) lo:0 Link encap:Local Loopback
inet addr:192.168.195.150 Mask:255.255.255.255 UP LOOPBACK RUNNING MTU:16436 Metric:1
Real Server 2
[root@nod2 ~]# echo 1 > /proc/sys/net/ipv4/conf/lo/arp_ignore
[root@nod2 ~]# echo 2 > /proc/sys/net/ipv4/conf/lo/arp_announce
[root@nod2 ~]# echo 1 >/proc/sys/net/ipv4/conf/all/arp_ignore
[root@nod2 ~]# echo 2 >/proc/sys/net/ipv4/conf/all/arp_announce
[root@nod2 ~]# ifconfig lo:0 192.168.195.150 broadcast 192.168.195.170 netmask 255.255.255.255 up
[root@nod2 ~]# route add -host 192.168.195.150 dev lo:0
Director 配置
[root@nod1 ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
[root@nod1 ~]# ifconfig eth0:1 192.168.195.150 broadcast 192.168.195.150 netmask 255.255.255.255 up
[root@nod1 ~]# route add -host 192.168.195.150 dev eth0:1
[root@nod1 ~]# iptables -F
[root@nod1 ~]# iptables -Z
[root@nod1 ~]# ipvsadm -Z
[root@nod1 ~]# ipvsadm -A -t 192.168.195.150:80 -s wlc
[root@nod1 ~]# ipvsadm -a -t 192.168.195.150:80 -r 192.168.195.170 -g -w 1
[root@nod1 ~]# ipvsadm -a -t 192.168.195.150:80 -r 192.168.195.171 -g -w 2
IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port
Conns InPkts OutPkts InBytes OutBytes
-> RemoteAddress:Port TCP 192.168.195.150:80 5091 25495 0 1824257 0
-> 192.168.195.170:80 1703 8534 0 612007 0 -> 192.168.195.171:80 3388 16961 0 1212250 0
LVS 之 DR model arp_announce arp_ignore转
标签:
原文地址:http://www.cnblogs.com/zengkefu/p/5491945.html