1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/bin/bash
.
/etc/rc
.d
/init
.d
/functions
LVS_VIP=192.168.122.15
NET_MASK=255.255.255.255
start()
{
ifconfig
lo:0 $LVS_VIP netmask $NET_MASK broadcast $LVS_VIP
route add -host $LVS_VIP dev lo:0
echo
"1"
>
/proc/sys/net/ipv4/conf/lo/arp_ignore
echo
"1"
>
/proc/sys/net/ipv4/conf/all/arp_ignore
echo
"2"
>
/proc/sys/net/ipv4/conf/lo/arp_announce
echo
"2"
>
/proc/sys/net/ipv4/conf/all/arp_announce
echo
"RealServer Start OK"
}
stop()
{
ifconfig
lo:0 down
route del $LVS_VIP
echo
"RealServer Stop OK"
}
case
"$1"
in
start)
start
;;
stop)
stop
;;
*)
echo
$
"Usage: $0 {start|stop}"
exit
1
esac
exit
$?
|
|
本文转自 kuangling 51CTO博客,原文链接:http://blog.51cto.com/kling/1239816