您的位置:首页 > 其它

DR模式

2013-03-18 21:57 148 查看
client配置:
client#ifconfig eth0 192.168.18.106
client#route add default gw 192.168.18.254

route配置:
route#ifconfig eth0 192.168.18.254
route#ifconfig eth0:0 192.168.19.100
打开ip转发:
route#vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
route#sysctl -p
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
route#

分发器配置:
FF#ifconfig eth0 192.168.19.200
绑定vip
FF#ifconfig eth0:0 192.168.19.250 netmask 255.255.255.255 broadcast 192.168.19.250 up
设置正确的路由:
FF#route add -host 192.168.19.250 dev eth0:0
安装ipvsadm:
FF#mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
FF#cd /mnt/Cluster
FF#rpm -ivh ipvsadm-1.24-10.i386.rpm
warning: ipvsadm-1.24-10.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:ipvsadm ########################################### [100%]
FF#

设定分发规则:
FF#ipvsadm -A -t 192.168.19.250:80 -s rr
FF#ipvsadm -a -t 192.168.19.250:80 -r 192.168.19.101 -g
FF#ipvsadm -a -t 192.168.19.250:80 -r 192.168.19.102 -g
FF#

apache设置:
apache1:
apache1#mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
apache1#yum install install httpd -y
apache1#/etc/init.d/httpd restart
停止 httpd: [失败]
启动 httpd: [确定]
apache1#

apache1#ifconfig eth0 192.168.19.101
绑定vip:
apache1#ifconfig lo:0 192.168.19.250 netmask 255.255.255.255 broadcast 192.168.19.250 up
设置到主机的路由:
apache1#route add -host 192.168.19.250 dev lo:0
设置默认路由:
apache1#route add default gw 192.168.19.100
保证arp协议在连接过程中,路由器上,只知道网络中192.168.19.250对应的是分发器。
apache1#echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
apache1#echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
设置测试页:
apache1#echo "hello" > /var/www/html/index.html
apache1#
重启服务:
apache1#/etc/init.d/httpd restart
停止 httpd: [确定]
启动 httpd: [确定]
apache1#

apache2:
apache2#mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
apache2#yum install install httpd -y
apache2#/etc/init.d/httpd restart
停止 httpd: [失败]
启动 httpd: [确定]
apache2#

apache2#ifconfig eth0 192.168.19.102
绑定vip:
apache2#ifconfig lo:0 192.168.19.250 netmask 255.255.255.255 broadcast 192.168.19.250 up
设置到主机的路由:
apache2#route add -host 192.168.19.250 dev lo:0
设置默认路由:
apache2#route add default gw 192.168.19.100
保证arp协议在连接过程中,路由器上,只知道网络中192.168.19.250对应的是分发器。
apache2#echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
apache2#echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
设置测试页:
apache2#echo "welcome" > /var/www/html/index.html
apache2#
重启服务:
apache2#/etc/init.d/httpd restart
停止 httpd: [确定]
启动 httpd: [确定]
apache2#

client测试:
client#elinks http://192.168.19.250 --dump
welcome
client#elinks http://192.168.19.250 --dump
hello
client#elinks http://192.168.19.250 --dump
welcome
client#elinks http://192.168.19.250 --dump
hello
client#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  DR模式