Just_DoIt
Posts: 5
Joined: Sat May 05, 2018 12:12 pm

[solved] RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Sat May 05, 2018 12:24 pm

Hi,
I'm running a fresh install of RASPBIAN STRETCH LITE on my RaspberryPi B but have some trubble getting Wifi to work.

I do see the interface wlan0. ifconfig shows this:

Code: Select all

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.48.142  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::6635:d10:6480:1b6f  prefixlen 64  scopeid 0x20<link>
        ether 10:fe:ed:23:54:1c  txqueuelen 1000  (Ethernet)
        RX packets 3  bytes 427 (427.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 188  bytes 30183 (29.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
But trying to renew the ip via sudo dhclient -v wlan0 only shows:

Code: Select all

pi@raspberrypi:~ $ sudo dhclient -v wlan0
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/10:fe:ed:23:54:1c
Sending on   LPF/wlan0/10:fe:ed:23:54:1c
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 21
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
Doin the same on eth0 works:

Code: Select all

pi@raspberrypi:~ $ sudo dhclient -v eth0
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/b8:27:eb:dc:f7:82
Sending on   LPF/eth0/b8:27:eb:dc:f7:82
Sending on   Socket/fallback
DHCPREQUEST of 10.1.1.61 on eth0 to 255.255.255.255 port 67
DHCPACK of 10.1.1.61 from 10.1.1.1
RTNETLINK answers: File exists
bound to 10.1.1.61 -- renewal in 392062 seconds.
Both eth0 and wlan0 are connected to the very same router / DHCP-server.

I've check the WiFi connection and also did a reconfigure with wpa_cli:

Code: Select all

pi@raspberrypi:~ $ sudo wpa_cli 
wpa_cli v2.4
Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.


Selected interface 'wlan0'

Interactive mode

> reconfigure
OK
<3>CTRL-EVENT-DISCONNECTED bssid=60:31:97:fa:3b:a6 reason=3 locally_generated=1
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
<3>CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=DE
<3>CTRL-EVENT-SCAN-RESULTS 
<3>WPS-AP-AVAILABLE 
<3>SME: Trying to authenticate with 60:31:97:fa:3b:a6 (SSID='Meins' freq=2422 MHz)
<3>Trying to associate with 60:31:97:fa:3b:a6 (SSID='Meins' freq=2422 MHz)
<3>Associated with 60:31:97:fa:3b:a6
<3>WPA: Key negotiation completed with 60:31:97:fa:3b:a6 [PTK=CCMP GTK=CCMP]
<3>CTRL-EVENT-CONNECTED - Connection to 60:31:97:fa:3b:a6 completed [id=0 id_str=]
<3>CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=DE
But I still get no IP.

Ayn idea what to check, how to debug this issue?

Dirk
Last edited by Just_DoIt on Wed May 09, 2018 5:00 pm, edited 1 time in total.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Sat May 05, 2018 2:28 pm

Did you set up everything correctly in raspi-config? Your wifi won't work unless you set the country code.

Just_DoIt
Posts: 5
Joined: Sat May 05, 2018 12:12 pm

Re: RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Sat May 05, 2018 3:04 pm

SurferTim wrote:
Sat May 05, 2018 2:28 pm
Did you set up everything correctly in raspi-config? Your wifi won't work unless you set the country code.
I did. And I guess the "alpha2=DE" shows wpa_cli knows it.

Dirk

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Sat May 05, 2018 3:13 pm

Take a look in /etc/wpa_supplicant/wpa_supplicant.conf. Does it show a country code also?

Edit: Maybe you should post the entire contents of that file.

Just_DoIt
Posts: 5
Joined: Sat May 05, 2018 12:12 pm

Re: RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Sat May 05, 2018 4:13 pm

SurferTim wrote:
Sat May 05, 2018 3:13 pm
Take a look in /etc/wpa_supplicant/wpa_supplicant.conf. Does it show a country code also?
Yes, it does. This is the complete file:

Code: Select all

pi@raspberrypi:~ $ cat /etc/wpa_supplicant/wpa_supplicant.conf 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=DE

network={
	ssid="yyyyy"
	psk="xxxxxxxx"
}
Dirk

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Sat May 05, 2018 4:20 pm

Has your tp-link WiFi dongle ever been used successfully on this or any other RPi?

Or on any other non- RPi hardware?

Does your WiFi access point allow associations from other workstations?

Have you tried restarting the wifi access point?

Just_DoIt
Posts: 5
Joined: Sat May 05, 2018 12:12 pm

Re: RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Sat May 05, 2018 4:56 pm

B.Goode wrote:
Sat May 05, 2018 4:20 pm
Has your tp-link WiFi dongle ever been used successfully on this or any other RPi?
Yes, it has worked on this RPi with the same OS a few times in the beginning. I first thought I screwed something so I've reinstall raspbian from scratch. (Same image)
B.Goode wrote:
Sat May 05, 2018 4:20 pm
Or on any other non- RPi hardware?
Never tested.
B.Goode wrote:
Sat May 05, 2018 4:20 pm
Does your WiFi access point allow associations from other workstations?
Yes it does. All other devices have no issues.
B.Goode wrote:
Sat May 05, 2018 4:20 pm
Have you tried restarting the wifi access point?
Two times. :-)

And it seems my AP has assigned an IP address to the WiFi interface, because it is listed twice. One entry for the eth0 connection (I did connect it via LAN to ssh into it) and one (showing the wlan0 MAC) with a different IP. But the RPi still shows: inet 169.254.48.142 And I can't ping the second IP, while the first one obviously works. :-)

Dirk

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Sat May 05, 2018 8:36 pm

And it seems my AP has assigned an IP address to the WiFi interface, because it is listed twice. One entry for the eth0 connection (I did connect it via LAN to ssh into it) and one (showing the wlan0 MAC) with a different IP. But the RPi still shows: inet 169.254.48.142


169.254.48.142 is a 'fall-back' address in a range that Raspbian (and other operating systems) resort to if an attempt to get an IP address via DHCP fails. It can't be used to communicate via your home router.

It remains a puzzle (to me) why the RPi is not automatically picking up the address assigned by your DHCP server. Is it another 10.1.1.x address?

I don't think it will make a difference to address assignment, but does disconnecting the cabled Ethernet connection before rebooting the RPi change the outcome?

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Wed May 09, 2018 5:23 am

Any 169.254.xxx.xxx/16 link-local address means that your WiFi isn't associated or your cat5 cable isn't connected (at both ends). It's generated by the system because your Raspberry doesn't have a fixed IP address and can't contact the DHCP server on your network.

Check cables. Check WiFi credentials in /etc/wpa_supplicant/wpa_supplicant.conf. Check you've got

Code: Select all

country=GB
(with your ISO country code) defined.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Just_DoIt
Posts: 5
Joined: Sat May 05, 2018 12:12 pm

Re: RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Wed May 09, 2018 5:00 pm

Well, I still don't know why, but my second WLAN AP (no DHCP server) was causing this. After rebooting the device the DHCP worked like expected.

Thanks to all who helped.

SpottyMatt
Posts: 1
Joined: Mon Nov 26, 2018 5:25 am

Re: RASPBIAN STRETCH LITE, DHCP on WLAN0 fails

Mon Nov 26, 2018 5:37 am

Just_DoIt wrote:
Wed May 09, 2018 5:00 pm
my second WLAN AP (no DHCP server) was causing this.
Thank you for following up!

I was experiencing this same issue and landed in this thread. I read it like a narrative of my own life, but your follow-up... Yes, in fact, I also had a 2nd access point (no DHCP server) - a mesh-network range extender, that was closer to the Pi than the main AP.

Unplugged the extender and the Pi reconnected and got a DHCP lease in under 10 seconds.

There had been a recent power outage and I guess the extender didn't correctly re-sync with the main AP?

Return to “Troubleshooting”