Cannot successfully get IP address over DHCP

I have been trying to get my GoBox connected to wifi. I am able to connect directly via ethernet to my Mac and set up wifi using the Wifi setup tool. I can scan the networks, find my network and configure it.

When I do this, I am get a 169.x.x.x. address not an addressable address. This is the same wifi network that my laptop is connected to.

We’ve seen this problem a lot in the last few days on our forum. We’re still trying to work through it. One challenge is that we’re not able to consistently recreate the issue on our own (so as many details as you can provide would help us troubleshoot the problem for others).

Hey ericrobertrichard, we think that the issue is with Bonjour software. Bonjour seems to think your Pi is at one IP address, and when you put it on a new network (changing from ethernet to wifi) bonjour doesn’t catch the change.

Can you try to turn the wifi on your computer on and off? If you’re using a Mac, click on the wifi icon up at the top bar, and turn wifi off. Then after you’re disconnected (might want to confirm you’re disconnected by trying to pull up google on a browser window), turn wifi back on and connect to the wifi network.

Please let us know if this works.

Here’s the info on what I am doing.

  1. My MacBook Air is on wifi with a 192.168.1.x address
  2. I tether to my laptop using the ethernet cable (plugged into my my display port) and am able to ping dex.local and log into dex.local via my browser.

For example:

$ ping dex.local
PING dex.local (169.254.57.217): 56 data bytes
Request timeout for icmp_seq 0
64 bytes from 169.254.57.217: icmp_seq=1 ttl=64 time=0.522 ms
64 bytes from 169.254.57.217: icmp_seq=2 ttl=64 time=0.528 ms
64 bytes from 169.254.57.217: icmp_seq=3 ttl=64 time=0.600 ms
64 bytes from 169.254.57.217: icmp_seq=4 ttl=64 time=0.641 ms
64 bytes from 169.254.57.217: icmp_seq=5 ttl=64 time=0.527 ms
^C

  1. I use VNC to log into the device

  2. I run wifi setup

  3. I find my wireless network and configure it.

  4. When I connect to my wireless network, it seems to successfully connect with a status of “Completed (station)” but the IP address it gets back is a 169.x.x.x address.

Here is my ifconfig output after that:

pi@dex ~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:0d:6a:4a
inet addr:169.254.57.217 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2809 errors:0 dropped:0 overruns:0 frame:0
TX packets:2752 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:202563 (197.8 KiB) TX bytes:1494696 (1.4 MiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:3618 errors:0 dropped:0 overruns:0 frame:0
TX packets:3618 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1169144 (1.1 MiB) TX bytes:1169144 (1.1 MiB)

wlan0 Link encap:Ethernet HWaddr e8:4e:06:2b:bb:d1
inet addr:169.254.186.245 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:259 errors:0 dropped:267 overruns:0 frame:0
TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:372706 (363.9 KiB) TX bytes:21354 (20.8 KiB)

You can see the 169.x.x.x addresses on both eth0 (expected) and wlan0 (unexpected).

Here is the output from iwconfig:

$ iwconfig
wlan0 IEEE 802.11bgn ESSID:“erichard_network” Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency:2.437 GHz Access Point: D0:03:4B:62:AA:2C
Bit Rate:54 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=99/100 Signal level=61/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

lo no wireless extensions.

eth0 no wireless extensions.

If I go into my router (a Linksys LRT214) I can see in the DHCP status that this is showing as having an address of 169.254.186.245.

Just for hahas, I put a static binding in my router between the MAC address (e8:4e:06:2b:bb:d1) and a routable IP address, hit “disconnect” and then re-established the connection. It still came up with a 169 address.

I’m not exactly sure if this is the right command to run, but I ssh’ed into the device and ran the following to see if I could get more info:

$ sudo dhcpcd -T wlan0
dhcpcd[4007]: version 6.7.1 starting
dhcpcd[4007]: all: IPv6 kernel autoconf disabled
dhcpcd[4007]: wlan0: IPv6 kernel autoconf disabled
dhcpcd[4007]: wlan0: adding address fe80::c03b:8500:46f1:c4d0
dhcpcd[4007]: if_addaddress6: Operation not supported
dhcpcd[4007]: DUID 00:01:00:01:1d:49:2e:c4:b8:27:eb:f1:3f:ca
dhcpcd[4007]: wlan0: IAID 06:2b:bb:d1
dhcpcd[4007]: wlan0: soliciting a DHCP lease
dhcpcd[4007]: wlan0: using IPv4LL address 169.254.253.190
interface='wlan0’
pid='4007’
reason='TEST’
skip_hooks='lookup-hostname’
ifcarrier='up’
ifflags='4163’
ifmtu='1500’
ifssid='erichard_network’
ifwireless='1’
new_broadcast_address='169.254.255.255’
new_ip_address='169.254.253.190’
new_network_number='169.254.0.0’
new_subnet_cidr='16’
new_subnet_mask='255.255.0.0’
dhcpcd[4007]: exited

Once I did this, I unplugged my ethernet cable.

Then, just to ensure I wasn’t caching any DNS entires on my local machine I ran:

$ sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;say cache flushed

Then, when I try to do the ping I see the following:

$ ping dex.local
PING dex.local (169.254.253.190): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4

You can see here that the IP address it is pinging is the wifi address, so not the eth0 address. It is just an unrouteable address.

It feels to me like something his happening in the DHCP process where the device isn’t properly getting the IP address from the DHCP server.

I’m going to post this information and look for any more info I can find.

Just one more data point here. I tried to force a new dhcp process expanding the timeout, adding in debug info and not allowing the fallback.

Here’s what I saw:

pi@dex ~ ps -ef | grep dhcp root 4698 1 0 13:21 ? 00:00:00 dhcpcd -d wlan0 pi 4734 4371 0 13:24 pts/1 00:00:00 grep --color=auto dhcp pi@dex ~ sudo kill 4698
pi@dex ~ $ sudo dhcpcd -d -L -t 60 wlan0
dhcpcd[4739]: version 6.7.1 starting
dhcpcd[4739]: all: IPv6 kernel autoconf disabled
dhcpcd[4739]: /proc/sys/net/ipv6/conf/all/accept_ra: No such file or directory
dhcpcd[4739]: wlan0: if_disable_autolinklocal: Address family not supported by protocol
dhcpcd[4739]: /proc/sys/net/ipv6/conf/wlan0/accept_ra: No such file or directory
dhcpcd[4739]: wlan0: adding address fe80::c03b:8500:46f1:c4d0
dhcpcd[4739]: wlan0: pltime infinity, vltime infinity
dhcpcd[4739]: if_addaddress6: Operation not supported
dhcpcd[4739]: wlan0: executing /lib/dhcpcd/dhcpcd-run-hooks' PREINIT dhcpcd[4739]: wlan0: executing/lib/dhcpcd/dhcpcd-run-hooks’ CARRIER
dhcpcd[4739]: DUID 00:01:00:01:1d:49:2e:c4:b8:27:eb:f1:3f:ca
dhcpcd[4739]: wlan0: IAID 06:2b:bb:d1
dhcpcd[4739]: wlan0: delaying IPv4 for 0.3 seconds
dhcpcd[4739]: wlan0: reading lease `/var/lib/dhcpcd5/dhcpcd-wlan0.lease’
dhcpcd[4739]: wlan0: discarding expired lease
dhcpcd[4739]: wlan0: soliciting a DHCP lease
dhcpcd[4739]: wlan0: sending DISCOVER (xid 0x42c2d5da), next in 3.4 seconds
dhcpcd[4739]: wlan0: sending DISCOVER (xid 0x42c2d5da), next in 7.1 seconds
dhcpcd[4739]: wlan0: sending DISCOVER (xid 0x42c2d5da), next in 15.3 seconds
dhcpcd[4739]: wlan0: sending DISCOVER (xid 0x42c2d5da), next in 32.6 seconds
dhcpcd[4739]: wlan0: sending DISCOVER (xid 0x42c2d5da), next in 63.9 seconds
dhcpcd[4739]: timed out
dhcpcd[4739]: exited

Looks to me like something is happening in the DHCP process where the device doesn’t think it is getting a response back.

That’s a ton of information! I’ll have to look over it one more time, just to be clear though, stupid question: after you’re all setup with ethernet, and the Pi is connected to the wifi network, did you disconnect the ethernet cable from the Pi? This is a step I’ve had trouble with in the past: if they’re both connected, something in the network mysteriously hangs up.

One more update here.

I plugged the ethernet line directly into a wall outlet that goes to my router (rather than going through my mac book air). From what I can tell from my router, even in this configuration, the device is not getting a proper addressable address.

So, this seems to imply this isn’t specific to the wireless adapter, but is affecting both eth0 and wlan0.

My suspicion is some sort of incompatibility between the linksys router and the raspberry pi?

At this point, I think I am out of ideas.

It sounds like you know what you’re doing; I’m not sure I can offer a lot more advice here. So this works fine with a direct ethernet connection, but when you try to connect through your network router (either wifi or ethernet) you can’t get a connection setup. Fair summary?

Have you tried the same configuration with a stock version of Raspbian?

I think I might just sound like I know what I am doing, but don’t be fooled. I am just bumbling around. So, any help is appreciated. =)

In terms of your answer about unnplugging from the computer, yes, I did that. Of course, I can’t then make connection to figure out what is going on.

Your summary is correct. I cannot get an address on my network (192.x.x.x) through either wifi or ethernet. The only way I can connect to my device is directly to my computer using a 169.x.x.x address.

Unfortunately, from what I can tell, when I connect directly to my computer, the device doesn’t actually have Internet access, so I can’t do things like update the software on it (which was one of the things I was going to try).

I have not tried the same with a stock version of Raspberry and don’t think I’d know how to do that. =) (See! I told you I don’t know what I am doing.)

Well, at the end of the day we’re all amateurs, right? It sounds like you really know what you’re doing!

Unfortunately, from what I can tell, when I connect directly to my computer, the device doesn’t actually have Internet access, so I can’t do things like update the software on it (which was one of the things I was going to try).

Aha, so we usually advise folks that step 1 is to connect between your pc/mac and the Pi. Step 2 is to pullup dex.local in the browser, and connect to your wifi network. Once connected to your wifi network, you should be able to ping dexterindustries.com from the command line. Maybe I’m misinterpreting the copied text above, but it sounds like you might not have connected to wifi with your Pi, while you’re connected by ethernet?

Maybe a video can explain this a little better: https://youtu.be/Ha1YiB2An18?list=PLGXEJ4Ye1qCNZ9OGYTXh7o8jSgO5-NHjY Sometime around 3:28.

After you’re able to ping to the outside world, you should be able to disconnect the ethernet cable, and ping from your mac to your Pi (if you’re both on the same wifi network).

Hi there, and Merry Christmas!

I may have something for you to try. I have no idea if it will be helpful or not in your case. I am on Windows, not Mac, but it does happen that my Box gets stuck with a 169.x.x.x IP address. I’m going to share what helps me out, with my setup, bearing in mind that we do have completely different setups.

After I connect to my Wifi, and it gives me back a 169 address, I run the following two commands :

sudo ifdown wlan0
sudo ifup wlan0

Usually, after the ifup, I get a normal IP, sometimes I need to run this pair of commands twice, but never more than twice.

Hopefully this will help.

Sorry for the confusion above. Let me try to re-explain.

  1. I connect the Pi to my laptop directly via ethernet
  2. I then VNC into the pi
  3. I use wifi setup to set up wifi and connect to the wifi network. Note: When this happens the IP address that the wifi adapter gets is a 169.x.x… address
  4. While still connected via ethernet and over VNC (or ssh), I launch the terminal. HEre’s what happens if I try to ping dexterindustries.com at this point:

pi@dex ~ $ ping dexterindustries.com
ping: unknown host dexterindustries.com

As far as I can tell, that is because I have no routes available:

$ sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
169.254.0.0 0.0.0.0 255.255.0.0 U 202 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 303 0 0 wlan0

My comment above (which caused confusion) about not being able to access the internet when just plugged into my computer was more me just saying that in this state I can’t download updates (and thus, if the problem was solved by an updated version of the O/S or something I can’t get it).

FYI, I have attained a minor success here.

I have configured the wlan0 interface on my Pi with a hard coded static IP/routes/name server/etc. Once I did that it is now able to connect to the internet (ping, download updates, etc.) I haven’t yet tried to unplug the ethernet cable, but I am pretty sure it will work as I can ping the wireless address from my laptop and can VNC into that address.

This is clearly a hack as it should work with DHCP. But, its progress.

If there is anything else I can provide to help diagnose this, let me know. But I think I may have worked around this issue.

Note: I strongly suspect that as soon as I update my machine it will write over my network configurations meaning I’ll have to do this again. =)

Hey Ericobertrichard, thanks for the update. I’m sorry to hear that this is a challenge and that you had to do that. I’m going to have to do more research into this and see what’s going on, see if I can replicate it. IS there anything else unique about your setup (network or PC) that you can think of that could help me simulate the problem?

Nothing particularly special. I have three Apple Airport Expresses, each set up in bridge mode for wireless roaming, all connected to a Linksys router who is acting as the DHCP server.

Another tool I just discovered for Mac is “Bonjour Browser” which you can install and download on your Mac. It can be downloaded here: http://www.tildesoft.com/

This will show you what’s available and what IP address each device is on (like if you have other printers or devices on your network using Bonjour). I’d be interested if it shows your Pi (even though you can’t ping it). If it does, and it shows an IP number, can you ping the IP number?