1

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

closed as off-topic by Milliways, goldilocks Oct 17 at 15:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers." – goldilocks
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Did you set up some firewall rules the last time you used the raspi? Or did you setup some firewall rules on your router. e.g. blocking all and let your PCs or Laptops IP and ICMP Packaets for all IPs going through. ??? – Peter Paul Kiefer Oct 15 at 17:00
  • @PeterPaulKiefer nope, I only have a couple of port forwarding rules. But then I forced the router to assign the Pi a different IP so they don't apply anymore, and nothing changed.. – Igor Shalyminov Oct 16 at 6:50
  • 1
    What replies do you get with ping raspbian.raspberrypi.org and with curl raspbian.raspberrypi.org/raspbian? – Ingo Oct 16 at 9:14
  • 1
    If it's really the same configuration on the second raspi 4 then the only difference between the 3 modes (raspi A with cable, raspi A with Wifi and raspi B with cable) is the MAC address, as far as I can see. Did you configure your router (in any way) with the MAC address of the raspi A's Ethernet Adapter (not WiFi). The UPD of your question makes it more confusing (but also interesting ;-) ). – Peter Paul Kiefer Oct 16 at 9:24
  • @Ingo please look at UPD2 – Igor Shalyminov Oct 16 at 18:27
2

This is a summary of the communication with Igor Shalyminov. It might be helpful for persons who will find themselves in a similar situation.

;TLDR Finally he solved the problem by resetting the router to its factory settings. The reason why it didn't work is still unclear.

Igors first observations were pings work as they should; and even name resolution was working. apt update and access to google.com were not possible. A traceroute log showed that, at least port 80 was blocked on the router.

My Thoughts: That seemed to me, like the router has some firewall rules active that drop outgoing http packets. Igor could not find any active rules beside a NAT configuration. He assigned another IP address to the raspi but, it does not work either.

Igor updated the question with an observation that seemed strange to me: The router does only block packets coming from the ethernet cable interface from one raspi, but does not block packets from the wifi dongle or the cable interface of a second raspi using the identical configuration as the first one.

My thoughts: That make me think that, the only difference, the router can be aware of, is the MAC addresses of the adapters.

Igor told me that, there were no MAC specific settings in the router. And it works now, after he performed a factory reset.

Some final thoughts ;-):

I'm pretty sure that the problem depended on the MAC addresses. Perhaps indirectly over the ARP table (MAC <-> IP) in the router and a blocking rule configuration. The firewall rules could also be indirectly induced be NAT or profiles eventually.

But I don't know the router and perhaps it is one of its feature I do not know.

Not the answer you're looking for? Browse other questions tagged or ask your own question.