Edit: I found the possible culprit, see end of question

I have started off Jessie, and I need the Pi to be able to connect to various Wi-Fi networks (it will get sent away, so it "just needs to work"). I have had no issues with two different networks here, but the one at my place is giving me headaches. For some reason, the Pi connects to the network (WPA) but does not get assigned a correct IP address, nor gateway. I have run out of ideas, so I will just dump all the various information I have:

$ sudo ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr b8:27:eb:24:80:03  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a881:c8dd:3d57:eb33/64 Scope:Link
          RX packets:363 errors:0 dropped:361 overruns:0 frame:0
          TX packets:41 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:105784 (103.3 KiB)  TX bytes:10547 (10.2 KiB)

In comparison, my desktop laptop with Debian gives me correct IP in the 10.0.0.x range:

$ sudo ifconfig wlp1s0
wlp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::47a5:8d5d:5cb9:285c  prefixlen 64  scopeid 0x20<link>
        ether b8:8a:60:a7:09:1d  txqueuelen 1000  (Ethernet)
        RX packets 28228503  bytes 35436324026 (33.0 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17543384  bytes 4640642944 (4.3 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

So the problem extends to the missing gateway:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     U     303    0        0 wlan0

Again, in comparison my working laptop:

$ sudo route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    600    0        0 wlp1s0   U     600    0        0 wlp1s0     U     1000   0        0 wlp1s0

The correct gateway is

Here are the network settings of thi Pi:

$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


$ cat /etc/dhcpcd.conf 
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.

# Use the hardware address of the interface for the Client ID.
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.

# Persist interface configuration when dhcpcd exits.

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
# Some interface drivers reset when changing the MTU so disabled by default.
#option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname

# interface eth0
# static ip_address=
# static routers=
# static domain_name_servers=

(I normally use a static IP on the ethernet for chatting with the laptop; as you can see, I have disabled that here to ensure there is no interference; for the record, eth0 is also not plugged in)

Wi-Fi memory:

$ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

    ssid="my-network's ssid"

And finally, the dhcp attempt:

$ sudo dhcpcd -T wlan0
dhcpcd[1213]: version 6.7.1 starting
dhcpcd[1213]: wlan0: IPv6 kernel autoconf disabled
dhcpcd[1213]: DUID 00:01:00:01:1f:77:66:4e:b8:27:eb:24:80:03
dhcpcd[1213]: wlan0: IAID eb:24:80:03
dhcpcd[1213]: wlan0: soliciting a DHCP lease
dhcpcd[1213]: wlan0: soliciting an IPv6 router
dhcpcd[1213]: wlan0: no IPv6 Routers available
^Cdhcpcd[1213]: received signal INT from PID 0, stopping
dhcpcd[1213]: exited

And consequently

$ cat /etc/resolv.conf 
# Generated by resolvconf

So nothing works:

$ ping
connect: Network is unreachable

I can do a manual trick, setting the IP with sudo ifconfig wlan0 and sudo route add default gw, after that I can ping IPs, but DNS is still not working. In any case, it's not a solution, because someone else will boot the Pi in another place and can't do manual IP configuration.

Edit: After seeing some comments about the dhcpcd -T, I thought that IP v6 might be the problem. I found this question; and hurray, this makes the system work:

sudo dhclient -4 -v wlan0

Now my questions are:

  1. What would be the correct way to make this permanent? I tried create this /etc/sysctl.d/local.conf as suggested, but it doesn't have any effect, after a reboot I have to run the above dhclient command again.
  2. Do I create a new possible problem for other Wi-Fi hot spots? In other words, can this setting lead to a situation where my system doesn't connect to a Wi-Fi network that it previously hadn't had any issues with?
  • And your question is??
    – Milliways
    Aug 20, 2018 at 22:24
  • @Milliways 1. Any ideas what the actual problem is here? 2. Should I use this 'dhclient -v' approach? If so, how do I make it permanent, and do I create a risk for other wi-fi routers if force ip v4?
    – 0__
    Aug 21, 2018 at 7:43


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.