LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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: 351

Rep: Reputation: 30
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
Posts: 2,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
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
Posts: 1,134

Rep: Reputation: 277Reputation: 277Reputation: 277
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
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
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: 351

Original Poster
Rep: Reputation: 30
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
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
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: 351

Original Poster
Rep: Reputation: 30
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
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
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: Fedora
Posts: 527

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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:54 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration