DR模式

DR模式作业:路由和客户端由林阳负责,转发器由范金楠负责,apache由郑国强负责
router/:
ifconfig eth0 192.168.18.254

ifconfig eth0:0 192.168.19.100

打开包转发

echo 1 > /proc/sys/net/ipv4/ip_forward

转发器:
[root@localhost ~]# yum install ipvsadm  装这个包之前先配置yum源添加一下内容
[root@localhost ~]# vim /etc/yum.repos.d/abc.repo
[Cluster]
name=Cluster
baseurl=file:///mnt/Cluster
enabled=1
gpgcheck=0
[root@localhost ~]# ifconfig eth0 192.168.19.200
[root@localhost ~]# ifconfig eth0:0 192.168.19.250 netmask 255.255.255.255 broadcast 192.168.19.250 up
[root@localhost ~]# route add -host 192.168.19.250 dev eth0:0
[root@localhost ~]# ipvsadm -A -t 192.168.19.250:80 -s rr
[root@localhost ~]# ipvsadm -a -t 192.168.19.250:80 -r 192.168.19.1 -g
[root@localhost ~]# ipvsadm -a -t 192.168.19.250:80 -r 192.168.19.2 -g
[root@localhost ~]# 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.19.250:80 rr
  -> 192.168.19.2:80              Route   1      0          0        
  -> 192.168.19.1:80              Route   1      0          0

apache19.1

[root@localhost ~]# yum install httpd -y

[root@localhost ~]# echo abc >index.html

[root@localhost ~]# router add default gw 192.168.19.100

[root@localhost ~]# ifconfig lo:0 192.168.19.250 netmask 255.255.255.255 broadcast 192.168.19.250 up

[root@localhost ~]#route add -host 192.168.19.250 dev lo:0

[root@localhost ~]#echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

[root@localhost ~]#echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore

[root@localhost ~]# service httpd restart

停止 httpd:                                               [确定]

启动 httpd:                                               [确定]

apache19.2

[root@localhost ~]# yum install httpd -y

[root@localhost ~]# echo cde >index.html

[root@localhost ~]# router add default gw 192.168.19.100

[root@localhost ~]# ifconfig lo:0 192.168.19.250 netmask 255.255.255.255 broadcast 192.168.19.250 up

[root@localhost ~]#route add -host 192.168.19.250 dev lo:0

[root@localhost ~]#echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

[root@localhost ~]#echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore

[root@localhost ~]# service httpd restart

停止 httpd:                                               [确定]

启动 httpd:                                               [确定]

 

 

你可能感兴趣的:(apache,包,File,router,转发器)