Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
DHCP client in background
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
senseiwa
n00b
n00b


Joined: 25 Jan 2004
Posts: 45

PostPosted: Wed Jun 09, 2004 3:12 pm    Post subject: DHCP client in background Reply with quote

Hi. I'm moving from a static ip to a dhcp network, and I'm not happy with the current behaviour of dhcp client.

I installed dhcpcd and set the conf.d/net to dhcp. The ugly thing is that when I'm unplugged, the boot sticks for 60 seconds on eth0, then the dhcp client daemon dies.

Is it possible to have a ``smarter'' daemon? I mean, DHCP on boot goes directly in background, then it tries to bring eth0 up finding a dhcp server, on no response it waits for some time and then tries again. Since it behaves like a real daemon, it should check always for a network, so unplugging the pc should wake the dhcp client daemon, and so it starts again to check for a server periodically.

The timeout isn't a real solution, as I said, mainly because the dhcpcd dies.
Back to top
View user's profile Send private message
thm
Tux's lil' helper
Tux's lil' helper


Joined: 15 Dec 2003
Posts: 77
Location: Munich

PostPosted: Wed Jun 09, 2004 4:37 pm    Post subject: Reply with quote

There is a conceptual and a technical problem here. The purpose of the dhcpcd is to talk to a DHCP server. If it can't find a server, it doesn't know what to do. To leave it running "in the background" would mean to potentially keep on broadcasting DHCP requests into a network forever if it doesn't have a DHCP server to respond. Clearly, that's not an acceptable option.

So, dhcpcd must (!) time out, unless it had some way to wait for or be called by the event "eth0 was just plugged in". AFAIK there is currently no simple and reliable means of doing that. Furthermore, until at least kernel 2.4 there was no generic means of finding out whether a network interface was actually plugged in or to determine its speed. I haven't looked at it in detail, but the new /sys filesystem suggests that there have been some improvements in that area. So maybe, someone will now get around to include "just plugged in"-detection into dhcpcd to make it (heaven forbid) more Microsoft-like.

Of course, you could write a cron job that first checks for a running dhcpcd daemon, then tries to detect the above event by some sort of stateful heuristics and then restarts eth0 using dhcpcd. But I doubt that it's worth the trouble. It's probably simpler to add
Code:
/etc/init.d/net.eth0 restart
to the sudo list and create an icon on your desktop that does just that

If you are just sick of waiting 60s when not plugged into a network, then simply reduce the timeout. 5s should easily do the job in most modern LANs unless they're really crowded.

Cheers
_________________
Thomas
Back to top
View user's profile Send private message
thm
Tux's lil' helper
Tux's lil' helper


Joined: 15 Dec 2003
Posts: 77
Location: Munich

PostPosted: Fri Jun 11, 2004 12:03 pm    Post subject: Reply with quote

Here is another way to avoid waiting 60s if the ethIF isn't plugged in
https://forums.gentoo.org/viewtopic.php?t=184424
_________________
Thomas
Back to top
View user's profile Send private message
nathandial
n00b
n00b


Joined: 25 May 2004
Posts: 22
Location: Birmingham, AL USA

PostPosted: Fri Jun 11, 2004 2:28 pm    Post subject: Reply with quote

knoppix does this. If you have a recent knoppix CD, boot it up and it will say "network card eth0 detected, configuring by DHCP ... backgrounding"

Not sure how it does that, but at least it appears to be possible. (unless I'm misunderstanding what knoppix is doing.) I don't think there would be real technical problems, it would wait for a while, then die if it didn't find something, same as if the system was waiting for it, only it would be in the background.

maybe you could just pop into the init script and put &'s everywhere?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum