我们有一些要求在这里解释。 我们尽力满足他们没有任何成功的描述。 这里是简要的信息:
这里有要求:
当前configuration:
服务器#1:每个10.17.243.11服务器#2的一个静态(实际)IP:每个10.17.243.12群集(虚拟和所有服务器之间共享)的一个静态(真实)IP:10.17.243.15
我尝试使用CLUSTERIP来获得集群IP,方法如下:
on the server #1 iptables -I INPUT -i eth0 -d 10.17.243.15 -j CLUSTERIP --new --hashmode sourceip --clustermac 01:00:5E:00:00:20 --total-nodes 2 --local-node 1 on the server #2 iptables -I INPUT -i eth0 -d 10.17.243.15 -j CLUSTERIP --new --hashmode sourceip --clustermac 01:00:5E:00:00:20 --total-nodes 2 --local-node 2
当我们尝试ping 10.17.243.15时,没有回复。 而web服务(端口8080上的tomcat)也不可访问。 然而,我们设法通过使用TCPDUMP在两台服务器上获取数据包。
一些有用的信息:
iptable roules(iptables -L -n -v):
Chain INPUT (policy ACCEPT 21775 packets, 1470K bytes) pkts bytes target prot opt in out source destination 0 0 CLUSTERIP all -- eth0 * 0.0.0.0/0 10.17.243.15 CLUSTERIP hashmode=sourceip clustermac=01:00:5E:00:00:20 total_nodes=2 local_node=1 hash_init=0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 14078 packets, 44M bytes) pkts bytes target prot opt in out source destination
日志消息:
... kernel: [ 7.329017] e1000e: eth3 NIC Link is Up 100 Mbps Full Duplex, Flow Control: None ... kernel: [ 7.329133] e1000e 0000:05:00.0: eth3: 10/100 speed: disabling TSO ... kernel: [ 7.329567] ADDRCONF(NETDEV_CHANGE): eth3: link becomes ready ... kernel: [ 71.333285] ip_tables: (C) 2000-2006 Netfilter Core Team ... kernel: [ 71.341804] nf_conntrack version 0.5.0 (16384 buckets, 65536 max) ... kernel: [ 71.343168] ipt_CLUSTERIP: ClusterIP Version 0.8 loaded successfully ... kernel: [ 108.456043] device eth0 entered promiscuous mode ... kernel: [ 112.678859] device eth0 left promiscuous mode ... kernel: [ 117.916050] device eth0 entered promiscuous mode ... kernel: [ 140.168848] device eth0 left promiscuous mode
TCPDUMP ping时:
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 12:11:55.335528 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84) 10.17.243.1 > 10.17.243.15: ICMP echo request, id 16162, seq 2390, length 64 12:11:56.335778 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84) 10.17.243.1 > 10.17.243.15: ICMP echo request, id 16162, seq 2391, length 64 12:11:57.336010 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84) 10.17.243.1 > 10.17.243.15: ICMP echo request, id 16162, seq 2392, length 64 12:11:58.336287 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84) 10.17.243.1 > 10.17.243.15: ICMP echo request, id 16162, seq 2393, length 64
ARPcaching:
Address HWtype HWaddress Flags Mask Iface 10.17.243.12 ether 00:90:0B:24:CA:58 C ETH01 10.17.243.11 ether 00:90:0B:24:CA:68 C ETH01 10.17.243.15 (incomplete) ETH01
我说的没有ping的答复。 有谁知道我错过了哪一部分?
提前致谢。
更新:要解决在ARPcaching中的集群IP的“不完整的”HW地址,我们手动添加了条目。
虽然我按照网页上所有相同的指示,但是显然有一个缺失的步骤。 我不确定是因为我的系统(包括软件或硬件规格)。 无论如何,根据我在Michael Schwartzkopff( Linxu杂志 )在网上find的指示,有必要在两台机器上运行以下代码(至less在我的情况下):
ip addr add 10.17.243.15/24 dev eth0
如果你按照网页上的指令+额外的步骤,ARPcaching中将不会有“不完整”的条目,一切工作正常。
感谢Michael Schwartzkopff 🙂
我们想要做和你一样的事情:拥有分配给两台服务器的虚拟IP。
我们在CentOS 7上运行。
所以我们这样做:
iptables -I INPUT -i ens160 -d 10.10.10.10 -j CLUSTERIP --new --hashmode sourceip --clustermac 01:00:5E:00:00:20 --total-nodes 2 --local-node 1 ip addr add 10.10.10.10/24 dev ens160
iptables -I INPUT -d 10.66.66.10 -i ens160 -j CLUSTERIP --new --hashmode sourceip --clustermac 01:00:5E:00:00:20 --total-nodes 2 --local-node 2 ip addr add 10.10.10.10/24 dev ens160
我们能够ping虚拟IP(但只能从Cluster01和Cluster02)。 我们在arpcaching上手动添加硬件地址:
arp -i ens160 -s 10.10.10.10 01:00:5E:00:00:20 # iptables -L -n -v Chain INPUT (policy ACCEPT 2221 packets, 151K bytes) pkts bytes target prot opt in out source destination 0 0 CLUSTERIP all -- ens160 * 0.0.0.0/0 10.10.10.10 CLUSTERIP hashmode=sourceip clustermac=01:00:5E:00:00:20 total_nodes=2 local_node=2 hash_init=0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 1536 packets, 1412K bytes) pkts bytes target prot opt in out source destination
在两台服务器上都有文件/proc/net/ipt_CLUSTERIP/10.10.10.10
在我的工作站上,我可以访问Cluster01和Cluster02上的网页,但在VirtualIP上却不起作用…