背景:
阅读新闻
LVS在企业网中的应用
[日期:2012-10-26] 来源:Linux社区 作者:Fighting [字体:]
案例二
LVS-DR
拓扑图
配置如下:
Web1[root@localhost ~]# echo "net.ipv4.conf.all.arp_ignore = 1" >>/etc/sysctl.conf
[root@localhost ~]# echo "net.ipv4.conf.all.arp_announce = 2" >>/etc/sysctl.conf
[root@localhost ~]# sysctl –p
添加一块新的设备,这里取名lo:0 ip地址为192.168.145.101子网掩码设为255.255.255.255
[root@localhost ~]# service network restart
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:F1:15:00
inet addr:192.168.145.200 Bcast:192.168.145.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fef1:1500/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:653 errors:0 dropped:0 overruns:0 frame:0
TX packets:639 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:82646 (80.7 KiB) TX bytes:125870 (122.9 KiB)
Interrupt:67 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:55 errors:0 dropped:0 overruns:0 frame:0
TX packets:55 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5785 (5.6 KiB) TX bytes:5785 (5.6 KiB)
lo:0 Link encap:Local Loopback
inet addr:192.168.145.101 Mask:255.255.255.255
UP LOOPBACK RUNNING MTU:16436 Metric:1
[root@localhost ~]# route add -host 192.168.145.101 dev lo:0
[root@localhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.145.101 0.0.0.0 255.255.255.255 UH 0 0 0 lo
192.168.145.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
#mount /dev/cdrom /mnt/cdrom
#yum install httpd –y
#cd /var/www/html/
#echo "web1” >>index.html
#service httpd start
web2这里采用ssh的安全传输,把web1的配置文件拷贝到web2上,就不用我们修改原来的文件了
前提是我们知道对方的帐号密码
[root@localhost ~]# scp 192.168.145.200:/etc/sysctl.conf /etc/
The authenticity of host '192.168.145.200 (192.168.145.200)' can't be established.
RSA key fingerprint is 5f:53:c0:d3:9e:b3:9e:96:80:d3:7d:51:f3:37:67:e8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.145.200' (RSA) to the list of known hosts.
root@192.168.145.200's password:
sysctl.conf 100% 1062 1.0KB/s
[root@localhost ~]# sysctl –p
添加一块新的设备,这里取名lo:0 ip地址为192.168.145.101子网掩码设为255.255.255.255
[root@localhost ~]# service network restart
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:C5:99:C3
inet addr:192.168.145.201 Bcast:192.168.145.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec5:99c3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:685 errors:0 dropped:0 overruns:0 frame:0
TX packets:534 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:104160 (101.7 KiB) TX bytes:104382 (101.9 KiB)
Interrupt:67 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:70 errors:0 dropped:0 overruns:0 frame:0
TX packets:70 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7793 (7.6 KiB) TX bytes:7793 (7.6 KiB)
lo:0 Link encap:Local Loopback
inet addr:192.168.145.101 Mask:255.255.255.255
UP LOOPBACK RUNNING MTU:16436 Metric:1
[root@localhost ~]# route add -host 192.168.145.101 dev lo:0
[root@localhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.145.101 0.0.0.0 255.255.255.255 UH 0 0 0 lo
192.168.145.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
#mount /dev/cdrom /mnt/cdrom
#yum install httpd –y
#cd /var/www/html/
#echo "web2” >>index.html
#service httpd start
Director
Corosync+OpenAIS+Pacemaker+Web+DRBD实现高可用群集
本文评论 查看全部评论 (0)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
最新资讯