我有两台 Ubuntu 机器,它们无法互相通信。
它们彼此相邻,并插入同一个交换机。它们都有静态 IP 地址和相同的网关。从我的笔记本电脑(在完全不同的网络上)我可以成功 ping 它们,并通过 ssh 和 mosh 连接到它们。它们都可以 ping 外部地址,例如 google.com,我可以通过 ssh 从它们两个连接到不同网络上的资源。
他们无法互相 ping 通或通过 ssh 互相连接。我不知道是什么问题可以让我从外部连接但不允许他们互相交谈。
我注意到的唯一可能有用的事情是错误不是对称的:
HOST1$ ping HOST2
PING HOST2 (47.51.66.227): 56 data bytes
^C
--- 47.51.66.227 ping statistics ---
18 packets transmitted, 0 packets received, 100% packet loss
与
HOST2$ ping HOST1
PING HOST1 (47.51.66.226) 56(84) bytes of data.
From 47.51.66.226 icmp_seq=1 Destination Host Unreachable
对于 ssh:
HOST1$ ssh HOST2
ssh: connect to host 47.51.66.227 port 22: Network is unreachable
与
HOST2$ ssh HOST1
ssh: connect to host 47.51.66.226 port 22: No route to host
考虑到这些机器的历史,我猜 HOST2 很可能在某个地方有一些奇怪的配置文件,但我不确定在哪里可以找到,因为我检查过的所有东西看起来都很标准。很高兴看到或发布任何有用的具体信息。
任何有关修复问题甚至如何更好地诊断问题的想法将不胜感激!
编辑以包含 Hauke Laging 请求的信息:
Host 1$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 34:73:5a:fb:23:d6 brd ff:ff:ff:ff:ff:ff
altname enp4s0f0
altname ens1f0
inet 47.51.66.226/30 brd 47.51.66.227 scope global noprefixroute eno1
valid_lft forever preferred_lft forever
inet6 2600:6c84:a900:2b2:2543:4ae5:dbb9:a80/64 scope global temporary dynamic
valid_lft 503165sec preferred_lft 1931sec
inet6 2600:6c84:a900:2b2:2f52:1e5a:3f1d:d294/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 503165sec preferred_lft 503165sec
inet6 fe80::1388:32c3:447:42aa/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 34:73:5a:fb:23:d7 brd ff:ff:ff:ff:ff:ff
altname enp4s0f1
altname ens1f1
4: wls5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 14:ab:c5:36:cc:fc brd ff:ff:ff:ff:ff:ff
altname wlp95s0
inet 10.42.0.1/24 brd 10.42.0.255 scope global noprefixroute wls5
valid_lft forever preferred_lft forever
inet6 fe80::da3a:9417:a11e:7f55/64 scope link noprefixroute
valid_lft forever preferred_lft forever
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:6c:fc:16:1b brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
6: br-38ee0842186e: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:13:73:72:29 brd ff:ff:ff:ff:ff:ff
inet 172.28.0.1/16 brd 172.28.255.255 scope global br-38ee0842186e
valid_lft forever preferred_lft forever
inet6 fe80::42:13ff:fe73:7229/64 scope link
valid_lft forever preferred_lft forever
7: br-64faac681e43: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:c5:9f:0c:e7 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 brd 172.18.255.255 scope global br-64faac681e43
valid_lft forever preferred_lft forever
inet6 fe80::42:c5ff:fe9f:ce7/64 scope link
valid_lft forever preferred_lft forever
9: vethebf8f2e@if8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-64faac681e43 state UP group default
link/ether 2a:74:2a:49:43:17 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::2874:2aff:fe49:4317/64 scope link
valid_lft forever preferred_lft forever
11: veth434243b@if10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-38ee0842186e state UP group default
link/ether d6:80:53:c8:97:ab brd ff:ff:ff:ff:ff:ff link-netnsid 5
inet6 fe80::d480:53ff:fec8:97ab/64 scope link
valid_lft forever preferred_lft forever
13: veth5605dd7@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-64faac681e43 state UP group default
link/ether 1e:32:e1:fa:b7:14 brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet6 fe80::1c32:e1ff:fefa:b714/64 scope link
valid_lft forever preferred_lft forever
15: vethef9eeac@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-38ee0842186e state UP group default
link/ether 7a:a7:d2:2c:9b:a7 brd ff:ff:ff:ff:ff:ff link-netnsid 4
inet6 fe80::78a7:d2ff:fe2c:9ba7/64 scope link
valid_lft forever preferred_lft forever
17: veth2a8d36c@if16: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-64faac681e43 state UP group default
link/ether f6:f5:27:c6:8e:fc brd ff:ff:ff:ff:ff:ff link-netnsid 3
inet6 fe80::f4f5:27ff:fec6:8efc/64 scope link
valid_lft forever preferred_lft forever
19: vetha420f5d@if18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-64faac681e43 state UP group default
link/ether f2:3b:25:fe:6f:eb brd ff:ff:ff:ff:ff:ff link-netnsid 2
inet6 fe80::f03b:25ff:fefe:6feb/64 scope link
valid_lft forever preferred_lft forever
21: vethd040ed9@if20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-64faac681e43 state UP group default
link/ether 06:d3:36:4f:ce:80 brd ff:ff:ff:ff:ff:ff link-netnsid 6
inet6 fe80::4d3:36ff:fe4f:ce80/64 scope link
valid_lft forever preferred_lft forever
HOST1$ ip r
default via 47.51.66.225 dev eno1 proto static metric 100
10.42.0.0/24 dev wls5 proto kernel scope link src 10.42.0.1 metric 600
47.51.66.224/30 dev eno1 proto kernel scope link src 47.51.66.226 metric 100
169.254.0.0/16 dev eno1 scope link metric 1000
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
172.18.0.0/16 dev br-64faac681e43 proto kernel scope link src 172.18.0.1
172.28.0.0/16 dev br-38ee0842186e proto kernel scope link src 172.28.0.1
HOST1$ ip neigh
10.42.0.176 dev wls5 lladdr d6:63:88:2f:99:18 STALE
172.28.0.2 dev br-38ee0842186e lladdr 02:42:ac:1c:00:02 STALE
10.42.0.36 dev wls5 FAILED
10.42.0.218 dev wls5 FAILED
172.18.0.4 dev br-64faac681e43 lladdr 02:42:ac:12:00:04 REACHABLE
47.51.66.225 dev eno1 lladdr 94:91:7f:3a:38:94 REACHABLE
192.168.1.1 dev eno1 lladdr 94:91:7f:3a:38:94 STALE
fe80::3eec:efff:feb9:caf8 dev eno1 lladdr 3c:ec:ef:b9:ca:f8 STALE
fe80::11:bb4e:5b23:413a dev wls5 lladdr bc:d0:74:3e:36:bc STALE
fe80::4e4:a9eb:9de8:6dd6 dev wls5 FAILED
fe80::9691:7fff:fe3a:3894 dev eno1 lladdr 94:91:7f:3a:38:94 router REACHABLE
fe80::cdf:8bd3:10de:fedf dev wls5 lladdr d6:63:88:2f:99:18 STALE
HOST1$ ss -tln sport = 22
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
HOST2$ 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 3c:ec:ef:b9:ca:f8 brd ff:ff:ff:ff:ff:ff
3: eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 3c:ec:ef:b9:ca:f9 brd ff:ff:ff:ff:ff:ff
inet 47.51.66.227/29 brd 47.51.66.231 scope global noprefixroute eno2
valid_lft forever preferred_lft forever
inet6 2600:6c84:a900:2b2::c68/128 scope global dynamic noprefixroute
valid_lft 2722sec preferred_lft 2722sec
inet6 2600:6c84:a900:2b2:54ac:eb83:5377:6d24/64 scope global temporary dynamic
valid_lft 502863sec preferred_lft 5964sec
inet6 2600:6c84:a900:2b2:af96:2c2f:4825:ef3f/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 502863sec preferred_lft 502863sec
inet6 fe80::343e:b7c0:7c32:d7a6/64 scope link noprefixroute
valid_lft forever preferred_lft forever
4: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 9a:60:86:38:17:cd brd ff:ff:ff:ff:ff:ff
inet 47.51.66.227/30 brd 47.51.66.227 scope global noprefixroute usb0
valid_lft forever preferred_lft forever
inet6 fe80::2ab8:a2b3:13eb:5d2/64 scope link noprefixroute
valid_lft forever preferred_lft forever
5: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:b3:fe:76:9d brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:b3ff:fefe:769d/64 scope link
valid_lft forever preferred_lft forever
7: veth5f11aad@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default
link/ether 42:67:78:26:bc:e4 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::4067:78ff:fe26:bce4/64 scope link
valid_lft forever preferred_lft forever
HOST2$ ip r
default via 47.51.66.225 dev eno2 proto static metric 101
default via 47.51.66.225 dev usb0 proto static metric 20100
47.51.66.224/30 dev usb0 proto kernel scope link src 47.51.66.227 metric 100
47.51.66.224/29 dev eno2 proto kernel scope link src 47.51.66.227 metric 101
169.254.0.0/16 dev usb0 scope link metric 1000
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
HOST2$ ip neigh
47.51.66.228 dev eno2 FAILED
47.51.66.225 dev eno2 lladdr 94:91:7f:3a:38:94 REACHABLE
47.51.66.226 dev usb0 FAILED
192.168.1.1 dev eno2 lladdr 94:91:7f:3a:38:94 STALE
47.51.66.225 dev usb0 FAILED
172.17.0.2 dev docker0 lladdr 02:42:ac:11:00:02 STALE
fe80::9691:7fff:fe3a:3894 dev eno2 lladdr 94:91:7f:3a:38:94 router STALE
该行47.51.66.226 dev usb0 FAILED
看起来很可疑,因为这是 HOST1 的地址,但没有 USB 以太网连接到该机器;只有 eno2 应该处于活动状态
HOST2$ ss -tln sport = 22
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
答案1
有两点值得注意
- 您在主机 1 上使用 eno1,在主机 2 上使用 eno2。确保您已将以太网电缆连接到每台主机上的正确端口。
- 在 host1 上,您使用的
47.51.66.226/30
是 的广播47.51.66.227
,但在 host2 上,您使用47.51.66.227/29
的是 的广播47.51.66.231
。这是行不通的,因为它们是不同的子网。
我没有进一步评论,因为这些都是塞子。