分类: LINUX
2009-11-04 17:08:24
|
执行 ipvsadm 后的输出 |
未安装ipvsadm |
-bash: ipvsadm: command not foun |
安装ipvsadm |
IP Virtual Server version
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn |
[root@hd-4 ipvsadm-1.24]# lsmod|grep ip_vs
ip_vs 77569 0 |
[root@huludao-2 ~]# more /usr/local/bin/lvs_real
#!/bin/bash
#description : start realserver
VIP=61.135.20.16
/etc/rc.d/init.d/functions
case "$1" in
start)
echo " start LVS of REALServer"
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/lo/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 "close LVS Directorserver"
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/lo/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 |
fav1# more /usr/local/bin/lvs_real_bsd
#!/usr/local/bin/bash
#description : start realserver
VIP=61.135.20.16
case "$1" in
start)
echo " start LVS of REALServer"
/sbin/ifconfig lo0 $VIP netmask 255.255.255.255 alias -arp up
;;
stop)
/sbin/ifconfig lo0 alias down
echo "close LVS Directorserver"
/sbin/ifconfig lo0 127.0.0.1 arp up
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac |
[root@huludao-2 ~]# ip add
1: lo:
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet 61.135.20.16/32 brd 61.135.20.16 scope global lo:0
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0:
link/ether 00:15:17:60:21:a0 brd ff:ff:ff:ff:ff:ff
inet 61.135.20.101/24 brd 125.38.38.255 scope global eth0
inet6 fe80::215:17ff:fe60:
valid_lft forever preferred_lft forever
3: eth1:
link/ether 00:15:17:60:21:a1 brd ff:ff:ff:ff:ff:ff
4: sit0:
link/sit
|
[root@huludao-2 ~]# lvs_real stop
close LVS Directorserver
[root@huludao-2 ~]# ip add
1: lo:
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0:
link/ether 00:15:17:60:21:a0 brd ff:ff:ff:ff:ff:ff
inet 125.38.38.101/28 brd 125.38.38.111 scope global eth0
inet6 fe80::215:17ff:fe60:
valid_lft forever preferred_lft forever
3: eth1:
link/ether 00:15:17:60:21:a1 brd ff:ff:ff:ff:ff:ff
4: sit0:
link/sit |
fav1# ifconfig
em0: flags=8843
options=19b
ether 00:15:17:6e:c8:46
inet 61.135.20.69 netmask 0xffffffc0 broadcast 61.128.20.127
media: Ethernet autoselect (100baseTX
status: active
lo0: flags=
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
inet 61.135.20.16 netmask 0xffffffff |