1

I have a freshly installed system ; it's Raspbian (based on Debian), on a Raspberry PI, installed with raspbian-ua-netinst. I believe this is a general linux question, though feel free to redirect me to the Raspberry stack exchange if you believe this is too specific.

It works fine if the ethernet cable is already plugged in during boot. However, if I boot without cable, and plug it after the system has booted, it won't get an IP address through DHCP (more precisely, I can't SSH into the system ; I don't have a screen on it right now so it's difficult to know what happens exactly).

Is there something I need to configure for dhclient to do its job when connecting the ethernet cable?

  • see raspberrypi.stackexchange.com/a/73847/78211 (restart dhcpcd should do the trick) – Fabian Apr 7 '18 at 12:12
  • I'm not sure what your are suggesting, that I should restart dhcpd each time my device boots? Isn't that a server side thing? I'm trying to get an IP address as a DHCP client here. Also, this is probably not related to the post you linked, this is not a wifi issue, I'm using an ethernet cable. – youen Apr 7 '18 at 12:26
  • Hmm, I made the test again, booting without cable, and plugging it afterwards. And it took quite a while, but after several minutes, I did get network connectivity. Is there some kind of periodic check for network configuration? I'll try to make more tests to find out how long it really takes, and if it works each time or not. – youen Apr 7 '18 at 12:46
0

It turns out that now it works. I don't know exactly what happened, but here are some possibilities:

  • maybe yesterday tests got screwed up by a bad contact when I plugged the cable, and there never was a software issue
  • I installed nfs-server in the meantime, which came with a bunch of dependencies and configuration, maybe that fixed the problem
  • maybe I wasn't waiting long enough for network to come up in my previous tests (I don't believe too much in this possibility since I remember waiting at least 5 minutes for one of the tests)

In any case, problem solved.

  • 1
    Some DHCP clients (eg: ISC's dhclient) have a lengthening retry cycle: at first they try again after a few seconds, and end up waiting several minutes between attempts. So yes a suggestion above to restart the dhcp client whenever the link goes up was a good idea. Try for example locally, not remotely, on any Linux system ip monitor link and unplug its network cable. You get the idea. Some tools (Network Manager...) already have hooks for this, but you can script a loop based on ip monitor link's output – A.B Apr 7 '18 at 15:46
  • @A.B Thanks for this additional information. Actually, as of today, it will get an IP within a few seconds after plugging the cable. I don't know what triggers the thing, but it's fast enough for me. I'm still a bit uneasy not understanding what changed since my first failed attempts, but, well, it works fine now... – youen Apr 8 '18 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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