标签:ipvsadm
[root@192 ~]# ipvsadm -A -t 192.168.1.212:80 -s wlc
[root@192 ~]# ipvsadm -a -t 192.168.1.212:80 -r 192.168.1.213:80 -m -w 2
[root@192 ~]# ipvsadm -a -t 192.168.1.212:80 -r 192.168.1.214:80 -m -w 2
[root@192 ~]# ipvsadm -Ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.1.212:80 wlc
-> 192.168.1.213:80 Masq 2 0 0
-> 192.168.1.214:80 Masq 2 0 0
[root@192 ~]# ipvsadm -Ln -c
IPVS connection entries
pro expire state source virtual destination
TCP 00:03 CLOSE 192.168.1.212:30840 192.168.1.212:80 192.168.1.214:80
[root@localhost ~]# ifconfig | awk -F ‘[ :]+‘ ‘FNR==2{print $4}‘
192.168.1.214
[root@localhost ~]# ifconfig | awk -F ‘[" ",:]+‘ ‘FNR==2{print $4}‘
192.168.1.214
[root@localhost ~]#
[root@localhost html]# ifconfig | awk -F ‘[" ",:]+‘ ‘FNR==2{print $4}‘ >> /var/www/html/index.html
192.168.1.214
[root@192 ~]# curl http://192.168.1.212/index.html
192.168.1.213
[root@192 ~]# curl http://192.168.1.212/index.html
192.168.1.214
[root@192 ~]# ipvsadm -Ln -c
IPVS connection entries
pro expire state source virtual destination
TCP 01:48 TIME_WAIT 192.168.1.212:30851 192.168.1.212:80 192.168.1.213:80
TCP 01:51 TIME_WAIT 192.168.1.212:30855 192.168.1.212:80 192.168.1.213:80
TCP 01:51 TIME_WAIT 192.168.1.212:30856 192.168.1.212:80 192.168.1.214:80
TCP 01:49 TIME_WAIT 192.168.1.212:30852 192.168.1.212:80 192.168.1.214:80
TCP 01:50 TIME_WAIT 192.168.1.212:30853 192.168.1.212:80 192.168.1.213:80
TCP 01:50 TIME_WAIT 192.168.1.212:30854 192.168.1.212:80 192.168.1.214:80
TCP 01:47 TIME_WAIT 192.168.1.212:30850 192.168.1.212:80 192.168.1.214:80
标签:ipvsadm
原文地址:http://wangqh.blog.51cto.com/5367393/1767823