Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 06-17-2008, 04:58 AM   #1
LQ Newbie
Registered: Apr 2003
Location: Philippines
Distribution: Slackware
Posts: 19

Rep: Reputation: 0
Script or program for continuously retrying to get an IP via DHCP

This has been a problem of mine since the Slackware 10.

My ISP's internet link can go down from time to time.

During that time, if my machine boots up, the initial dhcpcd tries to bind an IP address, and fails and dies.

Since the machine is a headless router and fileserver, I'd like it to continuously request for an IP address until it is granted one.
The exit error levels don't help at all since, the version used by slackware (2.0.x) has bugs when they fail to get an IP.

Does anybody have a script for this?

ifplugd won't work since there is no link down/up events. (Modem stays on all the time)
Old 06-17-2008, 07:36 AM   #2
Senior Member
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 231Reputation: 231Reputation: 231
I take it your current version of Slackware is 12.1 ? I think the network startup scripts have changed since Slackware 10 so the following may not work on older versions.

Not sure if this will work or even if it's the best way of doing things but dhcpcd man page reports an infinite timeout may be set by setting the timeout parameter, ( -t ), to 0.

I believe this may be achieved by adding a setting to /etc/rc.d/rc.inet1.conf. Add a line to the file:-
- where X is the interface number - i.e. set X to 0 for eth0, 1 for eth1 etc.

Looking at the /etc/rc.d/rc.inet1 script this should set the -t value of the dhcpcd call to 0.

It may work but as I said - this may not be the best way of getting the desired results.
Old 06-17-2008, 07:39 AM   #3
LQ Newbie
Registered: Apr 2003
Location: Philippines
Distribution: Slackware
Posts: 19

Original Poster
Rep: Reputation: 0
I've tried that before, but that cause boot up to hang until net comes back on - not the ideal scenario...

I was hoping more for a backgrounded type of thing.
Old 06-17-2008, 11:25 AM   #4
Registered: Dec 2006
Distribution: Slackware
Posts: 507

Rep: Reputation: 33
put it on a cron job to run every 10 sec?
Old 06-18-2008, 01:30 AM   #5
LQ Newbie
Registered: Apr 2003
Location: Philippines
Distribution: Slackware
Posts: 19

Original Poster
Rep: Reputation: 0
That might work. A script with lockfiles, set to be invoked every minute or so...


dhcpcd, networking

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
stop sendmail from retrying to send old mail fobster Linux - General 1 10-03-2006 04:54 PM
NFS: System Error: No route to host (retrying) lnthai2002 Linux - Networking 3 09-08-2006 12:45 PM
DHCP Script FlameKhan Linux - Networking 6 09-05-2005 02:30 AM
ENOMEM in do_get_write_access, retrying da_kidd_er Linux - Enterprise 1 11-18-2004 10:07 PM
The HD light flashing continuously domeili Linux - Newbie 2 10-29-2003 06:17 AM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:52 PM.

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