1

My Pi running Raspbian Stretch stopped being reachable via ssh, so I connected a screen to debug why, after turning it off and on again.

The GUI was all changed with the annoying message that says that Raspbian had been updated and conf files moved to oldconffiles. I hadn't run any upgrades and AFAIK I haven't enabled automatic upgrading.

The wlan0 interface now gets the IP 169.254.196.101, despite it being, to my knowledge, previously configured and working with the static IP 192.168.0.12 for the last months.

I tried to set up a static IP again by editing /etc/dhcpcd.conf as documented in the file:

interface wlan0
static ip_address=192.168.0.12/24

After a reboot, the interface has the desired IP but it cannot reach any other host and cannot be reached.

If I start the GUI, the WiFi reports as connected to my home network. In the router admin panel, the Pi appears as one of the connected devices via WiFi. I removed the static IP configuration and assigned the desired IP to the MAC on the router config. Now, whatever the configuration in dhcpcd.conf, the Pi appears as connected, but I cannot ping the router or any other host. Rebooting or turning wireless off has an effect on the router connected devices, so the list looks reliable.

When connecting with an ethernet cable, everything works normally.

Most search results point me to Jessie answers, which I don't think is helping, but at this point I have reverted all previous attempts.

EDIT(2):

Result of netstat -r. 192.168.0.1 is the IP of my router.

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.18.0.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0

Via the GUI network tool I specified the IP again and it shows up in the dhcpcd.conf file with the line:

SSID MYSSIDNAME
inform 192.168.0.12

Output of ip addr (with ethernet cable in):

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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:ce:c1:bb brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.19/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::c8ff:b708:f181:8036/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:9b:94:ee brd ff:ff:ff:ff:ff:ff
    inet 169.254.196.101/16 brd 169.254.255.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::4505:f456:75d0:3bfc/64 scope link 
       valid_lft forever preferred_lft forever

When ethernet cable is removed,

Output of ip route with ethernet cable connected, without it only the line for wlan0 is in the output.

default via 192.168.0.1 dev eth0 src 192.168.0.19 metric 202 
169.254.0.0/16 dev wlan0 proto kernel scope link src 169.254.196.101 metric 303 
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.19 metric 202 

This is the output of iw dev wlan0 info (edited SSID and MAC values):

Interface wlan0
    ifindex 3
    wdev 0x1
    addr fe:de:ab:dc:fe:de
    ssid MYSSIDNAME
    type managed
    wiphy 0
    channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
    txpower 31.00 dBm

And this is the output of iw dev wlan0 link (edited too, value for the router MAC is consistent with the output from my laptop):

Connected to 40:0e:11:e1:d1:1a (on wlan0)
    SSID: MYSSIDNAME
    freq: 2437
    RX: 136281 bytes (347 packets)
    TX: 2645360 bytes (44753 packets)
    signal: -42 dBm
    tx bitrate: 72.2 MBit/s

    bss flags:  short-preamble short-slot-time
    dtim period:    1
    beacon int: 100
  • 1
    Can you do a `netstat-r` and verify output shows a "default" route with the IP of your router on the wlan0 interface? – Tim Campbell Mar 02 '19 at 16:48
  • Edited to add the result of netstat @TimCampbell – Rubén Cabrera Mar 02 '19 at 16:51
  • The "Iface" is wrong. It should read "wlan0". This means that to reach the router, it wants to use the physical Ethernet. This explains why wlan0 can't reach the default router, but it does not explain how it ended up configured to the wrong interface. Have you manually edited network config files? – Tim Campbell Mar 02 '19 at 17:02
  • Sorry, I connected it with ethernet cable because I run a music server there and the silence was killing me. Let me unplug it and run again, sorry again! – Rubén Cabrera Mar 02 '19 at 17:04
  • I edited the network config files some time ago when the Pi wouldn't resolve names anymore after another upgrade. If I'm remembering correctly, I specified the OpenDNS urls. – Rubén Cabrera Mar 02 '19 at 17:13
  • For another configuration I have made a checkup but until **Checkpoint3** it is generic. Would you like to follow [Checkup wifi connection](https://raspberrypi.stackexchange.com/a/93636/79866) until **Checkpoint3**, maybe with a spare SD Card and tell us what Checkpoint failed? – Ingo Mar 02 '19 at 20:14
  • 1
    Possible duplicate of [DNS finds ip but cannot ping address](https://raspberrypi.stackexchange.com/questions/94847/dns-finds-ip-but-cannot-ping-address) – Milliways Mar 02 '19 at 21:51
  • The description of your linked question is different, @Milliways. I cannot ping anything but localhost. Not even the router. The only way I get local network IP is by having a static one defined in dhcpcd.conf. With the default config the Pi gets 169.254.196.101 – Rubén Cabrera Mar 02 '19 at 23:28
  • 1
    @RubénCabrera but the answer is the same - improper static IP setup - you may have other problems (your question is imprecise) but you need to fix the fundamentals first. If you get a [Link-local address](https://en.wikipedia.org/wiki/Link-local_address) the Pi cannot find a router. – Milliways Mar 02 '19 at 23:35
  • @Milliways My Pi has been working with static IP for months. Now the config I set up is gone and back to default and not working. I can't ping anything. There's no custom IP config anymore and the one I tried to set up again is not working. Neither the question nor the answer linked seem to be the same issue. – Rubén Cabrera Mar 02 '19 at 23:39
  • If I set the static IP for the eth0 interface, I get it without any issues. – Rubén Cabrera Mar 02 '19 at 23:40
  • What are the network address ranges (subnets) for **eth0** and for **wlan0** seen from the router (something like 169.254.0.0/16 or 192.168.0.0/24)? Does **eth0** and **wlan0** are on the same subnet, means the subnets are bridged on the router? Can you please add the output of this commands to your question `ip addr` and `ip route`? – Ingo Mar 03 '19 at 12:34
  • Outputs added at the end of the question, @Ingo Hope that answers your question. – Rubén Cabrera Mar 03 '19 at 20:42
  • Did you only have the interface and ip address set in /etc/dhcpcd.conf, and nothing else? – Sean Lee Mar 03 '19 at 23:23
  • @SeanLee That's the weird thing, AFAICR, I originally set it up in `/etc/network/interfaces`, but at some point things got reset in an upgrade that I didn't trigger manually. I don't remember setting it up again and I can't find any config where the IP is set up to be static right now, what I put in the question is a failed attempt at getting an IP in the right subnet. – Rubén Cabrera Mar 04 '19 at 20:06
  • Were you able to resolve your ip issue? /etc/network/interfaces was the older format. Make sure to remove entries there, and use /etc/dhcpcd.conf. Besides interface and ip address, add router address too. – Sean Lee Mar 07 '19 at 13:25
  • No luck yet, I'll be away a few days but will try to fix it when I'm back. Both `/etc/interfaces` and `dhcpcd.conf` are in the default settings but wlan0 keeps getting the local link address. – Rubén Cabrera Mar 07 '19 at 16:34

2 Answers2

0

This turned out to be a hardware problem, which became clearer when iw dev command gave different outputs in a matter of seconds, sometimes not showing the wlan0 interface. I had to give it up and use only wired interface for this raspberry.

0

As far as I can see is, that the wired connection has a DHCP server running so the interface eth0 gets an ip address 192.168.0.19 from it including other options like default route and DNS server addresses. Usually internet home router with wired and wireless connections bridge both and have a DHCP server running. Devices connected to it, no matter what connection is used, are all part of the same subnet, e.g. in your case 192.168.0.0/24. Assuming this I would expect that the RasPi connected by WiFi (wlan0) will also find the same DHCP server than from the wired connection (eth0). It should also get an ip address other than 192.168.0.19 with options from the subnet. This is not the case.

Instead you get a link-local address that is given when no DHCP server is found. Maybe there is no wireless ethernet connection at all.

  • Check if the wired and wireless connection on the router are bridged or if they have different subnets, e.g 192.168.0.0/24 for wired and maybe 192.168.1.0/24 for wireless.
  • Check if you can get an ip address from a DHCP server on the wireless connection.
  • Check your /etc/wpa_supplicant/wpa_supplicant.conf if it still matches all conditions to connect to the router.
  • Check WiFi connection on the RasPi by executing this commands: iw dev wlan0 info and iw dev wlan0 link

Do all checks with unplugged ethernet cable so only the WiFi connection comes to play. Tell us what you find.

Ingo
  • 40,606
  • 15
  • 76
  • 189
  • I don't understand the first point. I can access the router on 192.168.0.1 from wired and wireless. I can get IP addresses from DHCP from any other device at home and the Pi was getting an IP for months. wpa_supplicant.conf has the right information. I'm updating the question with the output of the commands. Thanks. – Rubén Cabrera Mar 03 '19 at 21:45
  • @RubénCabrera Sorry, I have given a wrong example subnet 192.168.0.1/24. It should be 192.168.1.0/24. I have corrected the answer. But about your comment: it is not possible to connect to 192.168.0.1 with an interface address of 169.254.196.101. They are on different subnets. This can only be done with routing, but 169.254.0.0/16 addresses are not routable. Check with `ping -I wlan0 192.168.0.1`. – Ingo Mar 03 '19 at 21:59
  • Thanks, it is clearer now. Pinging the router or any other address, in the subnet and of known hosts on the internet, fails (100% packet loss). – Rubén Cabrera Mar 03 '19 at 22:36