Ubuntu Sever 20.4 Raspberry PI 突然拒绝连接到其他服务器

Ubuntu Sever 20.4 Raspberry PI 突然拒绝连接到其他服务器

运行 Ubuntu Server 20.4 的 Raspberry Pi 4 突然停止连接到互联网上的任何服务。我无法再从我的 GitHub 存储库中提取数据,无法从我的节点应用程序向任何 API 发出 Web 请求,也无法使用 apt install 或 apt update。

我没有更改路由器的任何设置,防火墙也已禁用。之前一切都运行正常。是什么原因导致这个突然出现的问题?

有用的东西

  • www.google.com--> 来自 lb-140-82-118-4-ams.github.com (140.82.118.4) 的 64 字节:icmp_seq=1 ttl=48 time=64.5 毫秒

不起作用的东西

  • sudo apt update --> 错误:1http://ports.ubuntu.com/ubuntu-portsfocal InRelease 无法启动与 ports.ubuntu.com:80 (2001:67c:1360:8001::22) 的连接。- 连接 (101: 网络不可达) 无法连接到 ports.ubuntu.com:80 (91.189.88.150)。- 连接 (111: 连接被拒绝)
  • 卷曲www.google.com--> curl: (7) 无法连接到www.google.com端口 80:连接被拒绝
  • 卷曲https://www.google.com--> curl: (7) 无法连接到www.google.com端口 443:连接被拒绝
  • git pull --> 致命:无法访问‘https://github.com/myuser/myrepo.git/’:无法连接到 github.com 端口 443:连接被拒绝

不确定这是否与此有关,但在出现此问题之前我做的一件事是添加一个用户组并更改一些权限,以便在 ubuntu 中访问我的 raspberry pi 的 GPIO 数据。下面我附上了我的部分终端历史记录。

  144  sudo chown root.gpio /dev/gpiomem
  145  sudo chmod g+rw /dev/gpiomem 
  156  sudo groupadd gpio
  157  sudo usermod -a -G gpio ubuntu
  158  sudo grep gpio /etc/group
  159  sudo chown root.gpio /dev/gpiomem
  160  sudo chmod g+rw /dev/gpiomem

答案1

我在全新安装的 Raspberry Pi 4 上的 Ubuntu 20.4 中也遇到了类似的症状。

PING ports.ubuntu.com (91.189.88.142) 56(84) bytes of data.
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=1 ttl=55 time=25.0 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=2 ttl=55 time=25.1 ms
64 bytes from aerodent.canonical.com (91.189.88.142): icmp_seq=3 ttl=55 time=34.0 ms

--- ports.ubuntu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 25.002/28.039/34.033/4.238 ms

但是 telnet 不起作用:

root@ubuntu:/home/ubuntu# telnet ports.ubuntu.com 80
Trying 91.189.88.142...
Trying 91.189.88.152...

使用 tcpdump 只能看到 SYN 数据包:

root@ubuntu:/home/ubuntu# tcpdump -nn port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
07:42:24.184119 IP 192.168.17.113.58400 > 91.189.88.142.80: Flags [S], seq 2274442801, win 64240, options [mss 1460,sackOK,TS val 4200034123 ecr 0,nop,wscale 7], length 0
07:42:25.210681 IP 192.168.17.113.58400 > 91.189.88.142.80: Flags [S], seq 2274442801, win 64240, options [mss 1460,sackOK,TS val 4200035150 ecr 0,nop,wscale 7], length 0
07:42:27.183489 IP 192.168.17.113.58400 > 91.189.88.142.80: Flags [S], seq 2274442801, win 64240, options [mss 1460,sackOK,TS val 4200037122 ecr 0,nop,wscale 7], length 0
07:42:27.183977 IP 192.168.17.113.58316 > 91.189.88.152.80: Flags [S], seq 2274442804, win 64240, options [mss 1460,sackOK,TS val 4040348548 ecr 0,nop,wscale 7], length 0
07:42:28.186664 IP 192.168.17.113.58316 > 91.189.88.152.80: Flags [S], seq 2274442804, win 64240, options [mss 1460,sackOK,TS val 4040349551 ecr 0,nop,wscale 7], length 0
07:42:30.183479 IP 192.168.17.113.58316 > 91.189.88.152.80: Flags [S], seq 2274442804, win 64240, options [mss 1460,sackOK,TS val 4040351547 ecr 0,nop,wscale 7], length 0

在任何其他设备上它都可以正常工作。我能够使用 SSH 从本地网络连接到该设备。

iptables 连接已启用:

root@ubuntu:/home/ubuntu# iptables -L -n -v
Chain INPUT (policy ACCEPT 754 packets, 85649 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 484 packets, 113K bytes)
 pkts bytes target     prot opt in     out     source               destination

并且 UFW 处于非活动状态:

root@ubuntu:/home/ubuntu# ufw status
Status: inactive

有趣的是,这似乎只发生在端口 80 上。如果我尝试在某台机器上远程登录到端口 80,它不起作用。不过 443 似乎工作得很好……

相关内容