Ubuntu Sever 20.4 Raspberry PI suddenly refuses connection to other servers

Posted on

Problem :

My raspberry pi 4 running Ubuntu Server 20.4 suddenly stopped connecting to any services on the internet. I cannot pull from my github repository anymore, cannot make web requests to any APIs from my node application nor can I use apt install or apt update.

I have not changed any settings in my router and my firewall is disabled. Everything was working fine before. What may be causing this sudden issue?

Things that work

  • ping www.google.com –> 64 bytes from lb-140-82-118-4-ams.github.com (140.82.118.4): icmp_seq=1 ttl=48 time=64.5 ms

Things that don’t work

  • sudo apt update –> Err:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
    Cannot initiate the connection to ports.ubuntu.com:80 (2001:67c:1360:8001::22). – connect (101: Network is unreachable) Could not connect to ports.ubuntu.com:80 (91.189.88.150). – connect (111: Connection refused)
  • curl www.google.com –> curl: (7) Failed to connect to www.google.com port 80: Connection refused
  • curl https://www.google.com –> curl: (7) Failed to connect to www.google.com port 443: Connection refused
  • git pull –> fatal: unable to access ‘https://github.com/myuser/myrepo.git/’: Failed to connect to github.com port 443: Connection refused

Not sure if this is in any way related to this, but one thing I did to prior to this issue is adding a user group and changing some permissions in order access GPIO data of my raspberry pi in ubuntu. Below I have attached part of my terminal history.

  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

Solution :

I am experiencing similar symptoms myself with Ubuntu 20.4 on Raspberry Pi 4 with fresh installation.

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

But telnet does not work:

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

With tcpdump there is only SYN packet visible:

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

From any other device it works correctly. I am able to connect to the device using SSH from local network.

iptables connections are enabled:

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

And UFW is inactive:

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

Interesing is that this seems to be happening to port 80 only. If I try to telnet to port 80 on some machine it does not work. 443 seems to work well though…

Leave a Reply

Your email address will not be published. Required fields are marked *