我有两个在不同的公有IP的azure色虚拟机,其私有IP是:
10.10.1.9 10.10.1.6
当我从服务器10.10.1.6使用以下命令执行telnet时,出现错误:
telnet 10.10.1.9 2181 Trying 10.10.1.9... telnet: connect to address 10.10.1.9: No route to host
当我在10.10.1.9端做一个tcpdump的时候,我得到如下的日志:
#tcpdump -i eth0 port 2181 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 07:55:35.530270 IP 10.10.1.6.55910 > 10.10.1.9.eforward: Flags [S], seq 1018543857, win 14600, options [mss 1418,sackOK,TS val 181360935 ecr 0,nop,wscale 7], length 0
同时我也在10.10.1.6端做了一个tcpdump,同时我做了一个从10.10.1.6到10.10.1.9的telnet
tcpdump -i eth0 port 2181 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 07:55:57.970696 IP 10.10.1.6.55910 > 10.10.1.9.eforward: Flags [S], seq 1018543857, win 14600, options [mss 1460,sackOK,TS val 181360935 ecr 0,nop,wscale 7], length 0
** 10.10.1.9上的tcpdump和arp **
#tcpdump -i eth0 port 2181 or arp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 08:00:18.356153 IP 10.10.1.6.55944 > 10.10.1.9.eforward: Flags [S], seq 3337054296, win 14600, options [mss 1418,sackOK,TS val 181643770 ecr 0,nop,wscale 7], length 0 08:00:42.294801 ARP, Request who-has 10.10.1.6 tell 10.10.1.9, length 28 08:00:42.295859 ARP, Reply 10.10.1.6 is-at 12:34:56:78:9a:bc (oui Unknown), length 28
10.10.1.6上的tcpdump
tcpdump -i eth0 port 2181 or arp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 08:00:40.805565 IP 10.10.1.6.55944 > 10.10.1.9.eforward: Flags [S], seq 3337054296, win 14600, options [mss 1460,sackOK,TS val 181643770 ecr 0,nop,wscale 7], length 0 08:00:45.805204 ARP, Request who-has 10.10.1.9 tell 10.10.1.6, length 28 08:00:45.805721 ARP, Reply 10.10.1.9 is-at 12:34:56:78:9a:bc (oui Unknown), length 28 08:02:04.752283 ARP, Request who-has 10.10.1.9 tell 10.10.1.6, length 28 08:02:04.753141 ARP, Reply 10.10.1.9 is-at 12:34:56:78:9a:bc (oui Unknown), length 28
运行顺序:首先我在10.10.1.9和10.10.1.10上运行了tcpdumps,然后从10.10.1.10开始尝试telnet。
10.10.1.9上的arp -a
#arp -a ? (10.10.1.7) at 12:34:56:78:9a:bc [ether] on eth0 ? (10.10.1.4) at 12:34:56:78:9a:bc [ether] on eth0 ? (10.10.1.1) at 12:34:56:78:9a:bc [ether] on eth0 ? (10.10.1.8) at 12:34:56:78:9a:bc [ether] on eth0 ? (10.10.1.10) at <incomplete> on eth0 ? (10.10.1.11) at 12:34:56:78:9a:bc [ether] on eth0 ? (10.10.1.6) at 12:34:56:78:9a:bc [ether] on eth0 ? (10.10.1.5) at 12:34:56:78:9a:bc [ether] on eth0
10.10.1.6上的arp -a
#arp -a ? (10.10.1.1) at 12:34:56:78:9a:bc [ether] on eth0 ? (10.10.1.10) at <incomplete> on eth0 ? (10.10.1.9) at 12:34:56:78:9a:bc [ether] on eth0
10.10.1.6中的路由表
# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 168.63.129.16 10.10.1.1 255.255.255.255 UGH 0 0 0 eth0 10.10.1.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 1002 0 0 eth0 0.0.0.0 10.10.1.1 0.0.0.0 UG 0 0 0 eth0
10.10.1.9中的路由表
#route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 168.63.129.16 10.10.1.1 255.255.255.255 UGH 0 0 0 eth0 0.0.0.0 10.10.1.1 255.255.255.0 UG 0 0 0 eth0 10.10.1.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 1002 0 0 eth0 0.0.0.0 10.10.1.1 0.0.0.0 UG 0 0 0 eth0
提前致谢。
我在RHEL7上遇到了类似的问题,发现主机防火墙阻塞了传入的连接。 iptables显示了一个明确的规则来允许ssh访问; 其他连接被阻止。
如果您使用的是RHEL7(或使用firewalld的其他操作系统),请尝试使用firewall-cmd --add-port=2181/tcp (或--add-service作为知名端口,例如--add-service=https端口443上的HTTPS)。 如果清除它,然后--permanent ,使设置持久。