Tell me more ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

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.

share|improve this question
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 Nov 1 '12 at 16:03

1 Answer

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.

share|improve this answer
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 Oct 24 '12 at 20:42
@nos You need to find the network init script. I can't remember where it is off hand. – Alex Chamberlain Oct 24 '12 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 Oct 24 '12 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 Oct 24 '12 at 22:02
Editet the post - I'm using rasbpian – nos Oct 25 '12 at 17:54
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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