Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
11-06-2007, 10:16 AM
|
#1
|
|
Member
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 376
Rep:
|
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
|
|
|
|
11-06-2007, 09:43 PM
|
#2
|
|
Member
Registered: Mar 2005
Posts: 310
Rep:
|
Last edited by acid_kewpie; 11-18-2007 at 02:54 PM.
|
|
|
|
11-06-2007, 10:00 PM
|
#3
|
|
Member
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 376
Original Poster
Rep:
|
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.
|
|
|
|
03-26-2008, 08:11 AM
|
#4
|
|
LQ Newbie
Registered: Mar 2008
Posts: 1
Rep:
|
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.
|
|
|
|
03-27-2008, 08:50 PM
|
#5
|
|
Member
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 376
Original Poster
Rep:
|
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:55 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|