I have a Raspberry Pi 2 Model B running Raspbian Buster (upgraded from Stretch). I don't use it very often, but recently I noticed that I can't do apt update
because all the repos are unreachable (same for the rest of internet), but everything pings fine - both IPs and domain names.
Here's some diagnostics:
$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.31.254 netmask 255.255.255.0 broadcast 192.168.31.255
inet6 fe80::8e59:2756:5f89:2bb3 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:a0:ef:ef txqueuelen 1000 (Ethernet)
RX packets 202 bytes 18623 (18.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 205 bytes 35302 (34.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.31.1 0.0.0.0 UG 202 0 0 eth0
192.168.31.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
$ traceroute google.com
traceroute to google.com (64.233.165.100), 30 hops max, 60 byte packets
1 XiaoQiang (192.168.31.1) 0.796 ms 0.853 ms 0.696 ms
2 XiaoQiang (192.168.31.1) 0.926 ms 0.853 ms *
XiaoQiang is apparently my Xiaomi Mi Router 3, it's IP is set as the default gateway, and I'm not sure why the route breaks at that point.
UPD: internet's working fine when connected to the router via Wi-fi dongle, it only doesn't work over ethernet cable. Though this exact setup works fine over ethernet with my other RPi 4. Not sure what might be the case..
UPD2 more diagnostics:
$ ping raspbian.raspberrypi.org -c 4
PING mirrordirector.raspbian.org (93.93.128.193) 56(84) bytes of data.
64 bytes from 93.93.128.193 (93.93.128.193): icmp_seq=1 ttl=52 time=54.0 ms
64 bytes from 93.93.128.193 (93.93.128.193): icmp_seq=2 ttl=52 time=53.3 ms
64 bytes from 93.93.128.193 (93.93.128.193): icmp_seq=3 ttl=52 time=53.4 ms
64 bytes from 93.93.128.193 (93.93.128.193): icmp_seq=4 ttl=52 time=53.4 ms
--- mirrordirector.raspbian.org ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 8ms
rtt min/avg/max/mdev = 53.321/53.533/54.022/0.400 ms
$ curl -v raspbian.raspberrypi.org
* Expire in 0 ms for 6 (transfer 0x140880)
* Expire in 1 ms for 1 (transfer 0x140880)
* Expire in 0 ms for 1 (transfer 0x140880)
* Expire in 2 ms for 1 (transfer 0x140880)
* Expire in 0 ms for 1 (transfer 0x140880)
* Expire in 0 ms for 1 (transfer 0x140880)
* Expire in 2 ms for 1 (transfer 0x140880)
* Expire in 0 ms for 1 (transfer 0x140880)
* Expire in 0 ms for 1 (transfer 0x140880)
* Expire in 2 ms for 1 (transfer 0x140880)
* Expire in 0 ms for 1 (transfer 0x140880)
* Expire in 0 ms for 1 (transfer 0x140880)
* Expire in 2 ms for 1 (transfer 0x140880)
* Expire in 1 ms for 1 (transfer 0x140880)
* Expire in 1 ms for 1 (transfer 0x140880)
* Expire in 4 ms for 1 (transfer 0x140880)
* Expire in 1 ms for 1 (transfer 0x140880)
* Expire in 1 ms for 1 (transfer 0x140880)
* Expire in 4 ms for 1 (transfer 0x140880)
* Expire in 2 ms for 1 (transfer 0x140880)
* Expire in 2 ms for 1 (transfer 0x140880)
* Expire in 4 ms for 1 (transfer 0x140880)
* Expire in 2 ms for 1 (transfer 0x140880)
* Expire in 2 ms for 1 (transfer 0x140880)
* Expire in 3 ms for 1 (transfer 0x140880)
* Trying 93.93.128.193...
* TCP_NODELAY set
* Expire in 149994 ms for 3 (transfer 0x140880)
* Expire in 200 ms for 4 (transfer 0x140880)
* connect to 93.93.128.193 port 80 failed: Connection refused
* Trying 2a00:1098:0:80:1000:75:0:3...
* TCP_NODELAY set
* Expire in 149994 ms for 3 (transfer 0x140880)
* Immediate connect fail for 2a00:1098:0:80:1000:75:0:3: Network is unreachable
* Trying 2a00:1098:0:80:1000:75:0:3...
* TCP_NODELAY set
* Expire in 149994 ms for 3 (transfer 0x140880)
* Immediate connect fail for 2a00:1098:0:80:1000:75:0:3: Network is unreachable
* Failed to connect to raspbian.raspberrypi.org port 80: Connection refused
* Closing connection 0
curl: (7) Failed to connect to raspbian.raspberrypi.org port 80: Connection refused
ping raspbian.raspberrypi.org
and withcurl raspbian.raspberrypi.org/raspbian
?