[root@DR1 ~]# ifconfig eth0:0 10.220.5.223/24 up
测试vip是否可用,测试方法:从windows ping vip
在lvs中添加一个虚拟服务(vip)
[root@DR1 ~]# ipvsadm -A -t 10.220.5.223:80 -s rr
# 查看创建的虚拟服务
[root@DR1 ~]# service ipvsadm status
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 10.220.5.223:80 r
在虚拟服务中添加真是的服务器
[root@DR1 ~]# ipvsadm -a -t 10.220.5.223:80 -r 10.220.5.176:80 -w 1 -g
[root@DR1 ~]# ipvsadm -a -t 10.220.5.223:80 -r 10.220.5.177:80 -w 1 -g
# 查看一下RS的信息
[root@DR1 ~]# service ipvsadm status
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 10.220.5.223:80 rr
-> 10.220.5.176:80 Route 1 0 0
-> 10.220.5.177:80 Route 1 0 0
保存规则
[root@DR1 ~]# service ipvsadm save
ipvsadm: Saving IPVS table to /etc/sysconfig/ipvsadm: [ OK ]
# 查看状态
[root@DR1 ~]# ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 10.220.5.223:80 rr
-> 10.220.5.176:80 Route 1 0 0
-> 10.220.5.177:80 Route 1 0 0
安装配置web服务
安装配置web服务
[root@web1 ~]# yum install httpd -y
[root@web1 ~]# service httpd start
[root@web1 ~]# cd /var/www/html/
[root@web1 html]# vim index.html
test page 176