LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 11-06-2007, 10:16 AM   #1
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Question Missing /etc/init.d/dhcpd from ISC DHCPD


The good: I got tired of my Belkin router switching around IP addresses. So I downloaded DHCPD (Dynamic Host Configuration Protocol Daemon) from the Internet Systems Consortium, http://www.isc.org/sw/dhcp/. It built without a hitch (./configure; make; sudo make install) and runs well. I can tie "static" IPs to our 5 MAC addresses. BTW, the machine is on FC2, so yum dried up.

The ugly: The usual setup has a script /etc/init.d/dhcpd, symlinked into the appropriate runlevels. This makes dhcpd start at boot time, and simplifies administration. That part wasn't set up by "make install". (I have to start (/usr/sbin/)dhcpd manually after a reboot.)

I looked through the directory tree, and see it only in one place: contrib/dhcp.spec looks like a RPM specification, and it supports only Solaris. I could try contrib/solaris.init and maybe adapt it. But I wonder how everyone else does this. Searched LQ and Google, no luck.

Hoping Networking is the right category -- DHCP(D) isn't explicitly listed in the guidelines. Thanks for any advice or other insights!

/Quigi
 
Old 11-06-2007, 09:43 PM   #2
contusion
Member
 
Registered: Mar 2005
Posts: 310

Rep: Reputation: 35
Check this site for scripts: http://smarden.org/runit/runscripts.html

Last edited by acid_kewpie; 11-18-2007 at 02:54 PM.
 
Old 11-06-2007, 10:00 PM   #3
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Original Poster
Rep: Reputation: 31
Hi contusion, thanks for the link. While I like daemontools, I was looking for the /etc/init.d style script, which is the usual way to control services under Fedora Core, Ubuntu, Solaris, and probably a few others.

E.g., dhcp-3.1.0/contrib/solaris.init looks like this (and would get installed as /etc/init.d/dhcpd):
Code:
#!/bin/sh
# Contributed by Brian Murrell
 
state=$1
 
set `who -r`
case $state in
 
'start')
        if [ $9 = "2" -o $9 = "3" ]
        then
                exit
        fi
        if [ -f @PREFIX@/sbin/dhcpd ]; then
                echo "Starting the ISC DHCP server"
                @PREFIX@/sbin/dhcpd
        fi
        ;;
'stop')
        if [ -f @PREFIX@/etc/dhcpd.pid ]; then
                PID=`cat @PREFIX@/etc/dhcpd.pid`
                if [ -d /proc/$PID ]; then
                        echo "Stopping the ISC DHCP server"
                        kill $PID
                fi
        fi
        ;;
esac
In my case it's /usr/sbin/dhcpd and /var/run/dhcpd.pid. And my runlevels might differ.
 
Old 03-26-2008, 08:11 AM   #4
Wasskinny
LQ Newbie
 
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
Init Script, SysV for ISC DHCPD 4

Little fooling around and this is what I have. I thought it was interesting the distro didn't come with one. Improvements welcome.

Code:
#!/bin/sh
#
# dhcpd		Init Script to start/stop dhcpd.
#
# chkconfig:	- 61 39
# description:	If you dont know you shouldnt be here
#
# processname: dhcpd
config_file=/etc/dhcpd.conf
pidfile=/var/run/dhcpd.pid
lease_file=/var/db/dhcpd.leases


# Source function library
. /etc/rc.d/init.d/functions

# Get network config
. /etc/sysconfig/network

  if [ ! -e $config_file ]; then
    echo " No config file at $config_file"
    exit 0
  fi

RETVAL=0

start() {
  if [ ! -e $lease_file ]; then
        echo "  Creating $lease_file"
        touch $lease_file

  elif [ -f $pidfile ]; then
        PID=`cat $pidfile`
        echo "    ISC-DHCPD already running: $PID"
        exit 2;
  else
	echo -n $"Starting ISC-DHCPD: "
	daemon /usr/local/sbin/dhcpd -q 
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd		
	return $RETVAL
  fi
}

stop() {
	echo -n $"Stopping ISC-DHCPD: "
	killproc dhcpd
	RETVAL=$?
	echo
[ $RETVAL -eq 0 ] && rm -f /var/run/dhcpd.pid /var/lock/subsys/dhcpd
	return $RETVAL
}

restart() {
	stop
	start
}

reload() {
        echo -n $"Reloading dhcpd: "
        killproc dhcpd -USR2
        RETVAL=$?
        echo
        return $RETVAL
}


case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	status dhcpd
	;;
  restart)
	restart
	;;
  condrestart)
	[ -f /var/lock/subsys/dhcpd ] && restart || :
	;;
  reload)
	reload
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
	exit 1
esac

exit $?

Last edited by Wasskinny; 03-26-2008 at 08:14 AM.
 
Old 03-27-2008, 08:50 PM   #5
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Original Poster
Rep: Reputation: 31
Thank you very much, Wassinsky!
I put i in place, 'status' and 'stop' worked flawlessly, 'start' will need some tweaking.

Yes, I was surprised too that ISC's tarball didn't supply the file. I assume every distro (e.g., ubuntu) adds one.
 
  


Reply

Tags
dhcpd, init, install


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
Webmin ISC DHCPd 3.0.4 server not working archer007 Linux - Software 1 08-01-2007 05:44 AM
ISC-DHCPD v3 and agent.circuit-id wjonline Linux - Server 0 06-05-2007 10:02 AM
ISC-DHCPD on specified interface only? zivota Linux - Networking 2 02-06-2007 02:36 PM
DDNS with BIND and ISC-DHCPD joel112 Linux - Software 1 05-25-2006 11:06 AM
Issues with Dualhome ISC DHCPD psychobyte Linux - Networking 1 11-18-2005 04:03 PM


All times are GMT -5. The time now is 07:17 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