[root@localhost ~]# ifconfig //查看变化信息
eth0 Link encap:Ethernet HWaddr 00:0C:29:09:22:5D
inet addr:192.168.1.196 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe09:225d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:18342 errors:0 dropped:0 overruns:0 frame:0
TX packets:18549 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7480550 (7.1 MiB) TX bytes:10886441 (10.3 MiB)
Interrupt:169 Base address:0x2000
eth0:0 Link encap:Ethernet HWaddr 00:0C:29:09:22:5D
inet addr:192.168.1.200 Bcast:192.168.1.200 Mask:255.255.255.255
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:169 Base address:0x2000
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:88 errors:0 dropped:0 overruns:0 frame:0
TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6797 (6.6 KiB) TX bytes:6797 (6.6 KiB)
第二:在节点上的设置(由于在两个节点上的设置基本完全相同,故这里只设置节点之一)
在192.168.1.193上
[root@localhost ~]# ifconfig //查看网卡信息
eth0 Link encap:Ethernet HWaddr 00:0C:29:B7:97:5B
inet addr:192.168.1.193 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feb7:975b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:48655 errors:0 dropped:0 overruns:0 frame:0
TX packets:39793 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16204310 (15.4 MiB) TX bytes:6641366 (6.3 MiB)
Interrupt:169 Base address:0x2000
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:12600 errors:0 dropped:0 overruns:0 frame:0
TX packets:12600 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8047060 (7.6 MiB) TX bytes:8047060 (7.6 MiB)
[root@localhost ~]# vi /etc/init.d/lvscdr //编写ARP及VIP绑定脚本(两节点完全相同)
#!/bin/bash
#descrpption :start realserver DR
VIP=192.168.1.200
#./etc/rc.d/init.d/functions
case "$1" in
start)
echo "start LVS of RealServer DR"
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev lo:0
echo "1">/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2">/proc/sys/net/ipv4/conf/all/arp_announce
echo "1">/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2">/proc/sys/net/ipv4/conf/all/arp_announce
;;
stop)
/sbin/ifconfig lo:0 down
echo "0">/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "0">/proc/sys/net/ipv4/conf/all/arp_announce
echo "0">/proc/sys/net/ipv4/conf/all/arp_ignore
echo "0">/proc/sys/net/ipv4/conf/all/arp_announce
;;
*)
echo "Usage:$0 {start|stop}"
exit 1
esac
[root@localhost ~]# chmod a+x /etc/init.d/lvscdr
[root@localhost ~]# /etc/init.d/lvscdr start
[root@localhost ~]# ifconfig //查看变化信息
eth0 Link encap:Ethernet HWaddr 00:0C:29:B7:97:5B
inet addr:192.168.1.193 Bcast:192.168.1.255 Mask:255.255.255.0