本帖最后由 wsw13640218682 于 2016-1-24 11:32 编辑
将rs1,rs2的GATEWAY指向了192.168.0.5,我还特意将directory的第二个网卡设置为静态,用curl解释是200,可是为什么在浏览器上访问不可以的
最后重新修改虚拟机的设置(dir的一个网卡是桥接,一个是nat),另外两台虚拟机也是设置为nat)
[root@directory ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:30:00:5C
inet addr:192.168.137.128 Bcast:192.168.137.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe30:5c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:278 errors:0 dropped:0 overruns:0 frame:0
TX packets:312 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33032 (32.2 KiB) TX bytes:34582 (33.7 KiB)
Interrupt:19 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 00:0C:29:30:00:66
inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe30:66/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:300 errors:0 dropped:0 overruns:0 frame:0
TX packets:317 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:37366 (36.4 KiB) TX bytes:35009 (34.1 KiB)
Interrupt:19 Base address:0x2080
[root@directory ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HDADDR=00:0c:29:30:00:5c
TYPE=Ethernet
UUID=ccfebcfe-798c-4649-9ac9-1f958a06821e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
[root@directory ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
HDADDR=00:0c:29:30:00:66
TYPE=Ethernet
UUID=ccfebcfe-798c-4649-9ac9-1f958a06821e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.0.3
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=202.96.128.86
[root@rs1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HDADDR=00:0c:29:e5:7c:75
TYPE=Ethernet
UUID=ccfebcfe-798c-4649-9ac9-1f958a06821e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.137.129
NETMASK=255.255.255.0
GATEWAY=192.168.137.128
[root@rs2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HDADDR=00:0c:29:3e:67:ab
TYPE=Ethernet
UUID=ccfebcfe-798c-4649-9ac9-1f958a06821e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.137.130
NETMASK=255.255.255.0
GATEWAY=192.168.137.128
[root@directory ~]# 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.0.3:80 rr
-> 192.168.137.129:80 Masq 1 0 2
-> 192.168.137.130:80 Masq 1 0 2
[root@directory ~]# curl 192.168.0.3
111slave
[root@directory ~]# curl 192.168.0.3
222slave
将rs1,rs2的GATEWAY指向了192.168.0.5,我还特意将directory的第二个网卡设置为静态,用curl解释是200,可是为什么在浏览器上访问不可以的
最后重新修改虚拟机的设置(dir的一个网卡是桥接,一个是nat),另外两台虚拟机也是设置为nat)
[root@directory ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:30:00:5C
inet addr:192.168.137.128 Bcast:192.168.137.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe30:5c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:278 errors:0 dropped:0 overruns:0 frame:0
TX packets:312 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33032 (32.2 KiB) TX bytes:34582 (33.7 KiB)
Interrupt:19 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 00:0C:29:30:00:66
inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe30:66/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:300 errors:0 dropped:0 overruns:0 frame:0
TX packets:317 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:37366 (36.4 KiB) TX bytes:35009 (34.1 KiB)
Interrupt:19 Base address:0x2080
[root@directory ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HDADDR=00:0c:29:30:00:5c
TYPE=Ethernet
UUID=ccfebcfe-798c-4649-9ac9-1f958a06821e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
[root@directory ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
HDADDR=00:0c:29:30:00:66
TYPE=Ethernet
UUID=ccfebcfe-798c-4649-9ac9-1f958a06821e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.0.3
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=202.96.128.86
[root@rs1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HDADDR=00:0c:29:e5:7c:75
TYPE=Ethernet
UUID=ccfebcfe-798c-4649-9ac9-1f958a06821e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.137.129
NETMASK=255.255.255.0
GATEWAY=192.168.137.128
[root@rs2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HDADDR=00:0c:29:3e:67:ab
TYPE=Ethernet
UUID=ccfebcfe-798c-4649-9ac9-1f958a06821e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.137.130
NETMASK=255.255.255.0
GATEWAY=192.168.137.128
[root@directory ~]# 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.0.3:80 rr
-> 192.168.137.129:80 Masq 1 0 2
-> 192.168.137.130:80 Masq 1 0 2
[root@directory ~]# curl 192.168.0.3
111slave
[root@directory ~]# curl 192.168.0.3
222slave
编辑回复