It turns out raspberry pi doesn't try very hard to get an IP address with dhcp, during a power failure, my rpi booted faster than the dhcp server, and never got an IP address. In such a situation, the rpi seems to be booted, but it doesn't get an IP address, and I never see a dhcp request from it until I reboot it again.

dhclient is run as such:

dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0

I can't find any way to alter the arguments to dhclient, the -1 argument might be the culprt. How can I make my raspberrypi retry dhcp requests until it gets a reply ?

Edit: this is concerning the Raspbian “wheezy” distro.

  • 1
    Same problem with wifi. If Wifi Router is on at startup everything goes ok, even with router restart. But if the router is off when raspberry start it never gets an IP. Regards
    – user3127
    Commented Nov 1, 2012 at 16:03
  • I too have the same problem. However, I do not know how the dhclient is run. Is there some config or do I need to do something for that?
    – Kangkan
    Commented Oct 18, 2016 at 7:48

3 Answers 3


Remove the -1 from your command line arguments, then edit the timeout and retry values in /etc/dhclient.conf to your liking. You can look at the man page (man dhclient.conf) for more details.

  • The problem is, as said, I can't find any way to alter the command line of dhclient, it seems to magically somehow be started on boot by something in the ifupdown .deb package as something parses the /etc/network/interfaces
    – nos
    Commented Oct 24, 2012 at 20:42
  • @nos You need to find the network init script. I can't remember where it is off hand. Commented Oct 24, 2012 at 20:49
  • @Alex Chamberlain Turns out the command line for starting dhclient is hard coded in the /sbin/ifup binary. So I'm looking for alternative solutions at this point.
    – nos
    Commented Oct 24, 2012 at 21:27
  • Sorry about that. Anyway, what distro is that? Strange they'd hard code stuff into a binary. Solution-wise, you could just add a few lines to rc.local to kill the existing dhclient process and then start your own with custom args etc.
    – Munkeh
    Commented Oct 24, 2012 at 22:02
  • Editet the post - I'm using rasbpian
    – nos
    Commented Oct 25, 2012 at 17:54

What is the content of your /etc/network/interfaces?

I am assuming there is auto eth0 since it does query DHCP on boot.

What if you change that to allow_hotplug eth0? That should react to changes to the interface (cable inserted/removed), if i understand it correctly.

(All this is just my educated guess).

  • This tip works very well for me: it allows for hot-plugging, and speeds up boot-time. But it must be written as "allow-hotplug eth0". Commented Feb 24, 2014 at 20:53

There's a workaround given here by Jeroen: https://bugs.launchpad.net/raspbian/+bug/1125066

I have setup the workaround and rebooted - seems ok at the moment. Will confirm if problem resolved in an update after testing for a while.

Here's the workaround:

A workaround is to create a wrapper script by renaming /sbin/dhclient to /sbin/dhclient-bin and but the text below in /sbin/dhclient and afterwards chmod it to 777:

/sbin/dhclient-bin -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0

Your Answer

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

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