LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   dhcp won't start automatically on boot (https://www.linuxquestions.org/questions/slackware-14/dhcp-wont-start-automatically-on-boot-247216/)

blk96gt 10-25-2004 04:42 PM

dhcp won't start automatically on boot
 
For some odd reason, dhcpcd won't start up automatically anymore. This computer is being used as a server, and I set it up at my house and dhcp started just fine. But, when I set it up where I'm keeping it, I noticed that it wasn't starting on its own. I tried adding a line in rc.local with the command to start eth0(/sbin/dhcpcd eth0), but it seems like it would only try for about 2 seconds or so and then the login prompt would come up. When I start it manually it takes a little while to get the ip address. If this was my desktop computer I wouldn't mind, but since this is being used as a server, and also doesn't have a keyboard, mouse, and monitor hooked up to it, I would like to figure out a way to fix this in cause I have to resart or the power goes out. Any help would be appreciated.

philipacamaniac 10-25-2004 05:17 PM

dhcpcd should be starting from /etc/rc.d/rc.inet1, so take a look in there, and also make sure that file has execute privileges (if not then run /bin/chmod 755 /etc/rc.d/rc.inet1).

Check the configuration file. In /etc/rc.d/rc.inet1.conf, you should have a section that looks like this:
Code:

# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""

On that note... shouldn't a server have a static IP so you can forward packets from your gateway/router?

rotvogel 10-25-2004 06:49 PM

I use a little script which I run in cron every 5 minutes. Here it is:
Code:

#!/bin/sh
#
# dhcp-check - checks status of dhcp client
# in this case dhcpcd with a pid in /etc/dhcpc
# and restarts it when it is not running
#
if [ -f /etc/dhcpc/dhcpcd-eth0.pid ]; then
    echo DHCP client is running already...
else
    /sbin/dhcpcd -t 30 -d eth0 && /etc/rc.d/rc.firewall restart
fi

Note: this one is for eth0, if you use another external device please adjust every instance of eth0 to the device you're using. The -t 30 is an extended period for timing out on dhcp response. Slackware uses default 10 (secs) . I restart my firewall script after successfully (re)starting the dhcpcd daemon. If you do not want that you can leave it out ( delete the && /etc/rc.d/rc.firewall restart part)

blk96gt 10-25-2004 06:54 PM

Thanks rotvogel I didn't even thinking about making a script to run in cron.

philipacamaniac:
Everything in the rc.inet1 and rc.inet1.conf file are fine. As I said, it worked before I turned it off and brought it over to my gf's to set it up. And this server isn't behind a router/gateway, it's on a school network, so it's directly connected to the internet.

phoenix99 01-23-2005 06:43 PM

I've the same kind of problem.. but i dont know why.. before I add module to my 2.6.10 kernel, it's worked fine...
now when i boot in Slackware10 (current) dhcpcd is started (when i do a ps -aux) but i dont get any IP from my dhcp server. i must manualy do a /etc/rc.d/rc.inet1 stop and /etc/rc.d/rc.inet1 start
after it's work fine...

Anyone have an idead what i can do to fix it.. (if possible not a script... ) thanks !

phase9 01-24-2005 01:42 PM

Hi!

Maybe increasing the timeout would help dhcpcd to get an ip address.

Look for the following lines in /etc/rc.d/rc.inet1 and change `-t 10' to e.g. `-t 30'.

Code:

/sbin/dhcpcd -d -t 30 -h ${DHCP_HOSTNAME[$1]} eth${1}

/sbin/dhcpcd -d -t 30 eth${1}



All times are GMT -5. The time now is 12:05 AM.