LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 10-18-2011, 03:08 AM   #1
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 308

Rep: Reputation: 22
Question /etc/rc.d/rc.inet1 DHCP behaviour/setting issues when no carrier on interface


Hi
A few day ago I have noticed erroneous behaviour.
The box I have installed Slackware connected by twisted-pair wire directly to router. This router also works as DHCP server, and my box network configuration is fetched from it.
The problem begins when during box startup router is powered down. When dhcpcd -t 10 eth0 command works, there is no carrier on eth0 so dhcpcd successfully halts, so my box resides without network configuration forever even if router will bootup(what is definitely now what I or anybody want).
So question(and probably request to make such behaviour default in future release of Slackware): how to force dhcpcd to wait on interface until it find fetch configuration(i.e. to work in the same manner as if it fetched configuration normally)? I'm not experienced user in configuring network infrastructure so questioning here. man dhcdcd and man dhcpcd.conf does give any clues for me.
 
Old 10-18-2011, 05:27 AM   #2
cynwulf
Senior Member
 
Registered: Apr 2005
Distribution: OpenBSD, FreeBSD
Posts: 1,337

Rep: Reputation: Disabled
I'm not sure I understand what you're trying to do, but if you power up the machine while the router is still not up, it's obvious you're not going to get a dhcp lease. You could try increasing the dhcp timeout for the interface in /etc/rc.d/rc.inet1.conf

e.g. 1 minute
Code:
DHCP_TIMEOUT[0]="60"
 
Old 10-18-2011, 05:38 AM   #3
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware -current, 14.1
Posts: 1,048

Rep: Reputation: 170Reputation: 170
Since the router may not be powered up for a length of time, it may be better to set

Code:
DHCP_TIMEOUT[0]="0"
which will cause dhcpcd to wait *forever* (this setting can also be made global in /etc/dhcpcd.conf)

However, this will cause the startup process to pause, waiting for the lease; if this *isn't* the desired behaviour, you can edit rc.M to cause /etc/rc.d/rc.inet1 to fork to the background.

You could also set up a cron job to run dhcpcd every x seconds to poll for a lease on that interface until successful (or to restart rc.inet1 until successful, however not wise if multiple interfaces are in use simultaneously...)

cheers,
 
1 members found this post helpful.
Old 10-18-2011, 06:16 AM   #4
GazL
Senior Member
 
Registered: May 2008
Posts: 3,440

Rep: Reputation: 959Reputation: 959Reputation: 959Reputation: 959Reputation: 959Reputation: 959Reputation: 959Reputation: 959
Isn't this one of the things that those 'network-manager' type of apps were written to address?

Personally, I prefer the current behaviour as I try and avoid processes that constantly poll. If that means having to issue the odd command from time to time, then so be it.
 
1 members found this post helpful.
Old 10-18-2011, 06:47 AM   #5
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 308

Original Poster
Rep: Reputation: 22
Quote:
it's obvious you're not going to get a dhcp lease.
Yes, but when router will power up(or accidentally unplugged connector will be connected), I want to get lease as fast as possible. I.e I want dhcpcd to hang on interface always, regardless carrier presence.
For instance, I have two interfaces eth0 & eth1.
eth0 is connected and router on other side is up.
eth1 is connected but router on other side is down(or the same, if connector is unplugged).

When running rc.inet1 during boout-up:
1) dhcpcd will get lease for eth0 interface, and there will be a process /sbin/dhcpcd -t 10 eth0 (marking as A)
2) dhcpcd will detect NO CARRIER on eth1 and shutdown itself(i.e there is will not be any /sbin/dhcpcd -t 10 eth1 (marking as B))

When on eth0 connector accidentally unplugs, or router is down - i.e. no carrier on interface, process A will wait until carrier appear and re-request lease interface.
When on eth1 connecor will be replugged(or router power up) i.e. carrier will be detected, there is no such process B to rerequest lease. So eth1 will be uninitialised forever(or at least until some admin manually restart dhcpcd for this interface).

mrclisdue
Quote:
However, this will cause the startup process to pause, waiting for the lease; if this *isn't* the desired behaviour
No, it is not desired behaviour. System should start regardless interface states.
cron was first solution I have considered, but then I have thought a little "WTF? Why something else should do dhcpcd's work?"

Now I have found -b switch, which forks dhcpcd immediately regardless interface, but I prefer it to fork only after first retry failed, so I will see it in boot log. Is it possible? Tried both -b -B together but it stucks on carrier detection forever.

Anyway I very disappointed why this switch does not included into rc.inet1 by default. Such state reduces usability of Slackware as out-of-box blank system for different usage cases(i.e requires one more patch need to be applied before setup other business applications).
 
Old 10-18-2011, 08:24 AM   #6
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,465

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
I may be clueless, but I have thought a little "WTF? Why should Slackware do the network administrator's work?"
Your usage case seems highly artificial for a business setup. Maintaining the availability of the router and hence the DHCP server as well as the physical integrity of plug connections is not a software problem.
 
Old 10-18-2011, 10:10 AM   #7
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 308

Original Poster
Rep: Reputation: 22
allend, hotplugging new device is "artificial for a business setup"?
Let imagine, I have box with 10 interfaces. Two interfaces initially used - connected router, 8 reserved for future expansion. Software which uses them is configurable in runtime, i.e. I can add new record about new interface to database(or use some other administrative interface) and software will know immediately about available direction. The last problem is dhcpcd to assign interface configuration when device will be physically connected(if take into account that box will be locate let say in GMT-7 and Administrator locate at GMT+5 I assume ability to catch up new hardware without human supervision is very powerful feature of system). And usage of root shell to manually start dhcpcd or reboot system is strictly prohibited(first - no up sshd - closed another attack direction, second - system should be 99.99999% up which is impossible when required human interaction).
 
Old 10-18-2011, 10:40 AM   #8
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,465

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
Quote:
Let imagine, I have box with 10 interfaces.
Is this not hypothetical?
Quote:
Software which uses them is configurable in runtime, i.e. I can add new record about new interface to database(or use some other administrative interface)
...
And usage of root shell to manually start dhcpcd or reboot system is strictly prohibited
Is this not logically inconsistent?
Quote:
first - no up sshd - closed another attack direction
Is it not poor practice to not have a remote administration facility? The chances of a successful attack on a properly configured sshd are so low as to be practically negligible.

Quote:
system should be 99.99999% up which is impossible when required human interaction
I see what you are trying to do. You want to setup an automated failover system. That is an admirable aim. However, I do take issue with you expecting that this should be available to you out of the box with no effort on your part. It is impossible to provide solutions to all scenarios.
 
Old 10-19-2011, 12:19 AM   #9
rg3
Member
 
Registered: Jul 2007
Distribution: Slackware Linux
Posts: 512

Rep: Reputation: Disabled
I think if the router is powered down, there would be no carrier, essentially as if the cable was not plugged in. An app like ifplugd or netplug should solve the problem for this weird corner case, IMHO.
 
  


Reply

Tags
dhcpcd


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware Devs: Please add no-MTU setting for DHCP in rc.inet1 SiegeX Slackware 3 05-31-2010 03:32 PM
Slackware 12.2: Wireless interface predefined instead of taken from rc.inet1.conf? gargamel Slackware 21 12-29-2008 07:20 AM
rc.inet1 doesn't give me a new DHCP IP jsmith6 Slackware 3 03-10-2008 04:38 PM
rc.inet1 and a DHCP address ve1drg Slackware - Installation 2 11-11-2006 05:19 PM
Issues setting hostname with DHCP blaroe Ubuntu 2 05-30-2005 04:46 AM


All times are GMT -5. The time now is 12:51 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration