[K12OSN] The Dreaded DHCP on port 1067

cisna-barry at wc235.k12.il.us cisna-barry at wc235.k12.il.us
Tue Dec 26 13:54:33 UTC 2006


Dan,

For using dhcp on port the following will work for k12ltsp.This is a
copy/paste from my dhcpd.sh in the init.d folder( dhcp's startup script).
 All you need to do is copy paste this into gedit>save as> dhcpd.sh> drop
into your /etc/init.d folder>then> service dhcpd restart. You will see a
few extra lines when dhcpd restarts that you didnt see before. This is
NORMAL,,,.
Next simply go to wwwDOTrom-o-maticDOTnet and choose the etherboot image
for your particular NIC,> Choose option #3 to customize the boot image
your are downloading,then select from the variables the "port 1067" and
download this .zdsk image. Now your boot floppy will coincide with your
servers 1067 serving port for dhcp.You can do the same seqeunce for
example if you have rom chips as well on your nics.

Copy /Paste the following>
------------------------------------------------------------------------------------

#!/bin/sh
#
# dhcpd         This shell script takes care of starting and stopping
#               dhcpd.
#
# chkconfig: - 65 35
# description: dhcpd provide access to Dynamic Host Control Protocol.

# Added by Barry
DHCPORT="1067"

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

# Source networking configuration.
. /etc/sysconfig/network
. /etc/sysconfig/dhcpd

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/dhcpd ] || exit 0
CF='/etc/dhcpd.conf'
if [[ "$DHCPDARGS" = *-cf* ]]; then
    CF=`echo $DHCPDARGS | sed 's/^.*-cf[\ \	]*//;s/[\ \	].*$//';`;
fi;
[ -f "$CF" ] || exit 0
if [ ! -f /var/lib/dhcp/dhcpd.leases ] ; then
   touch /var/lib/dhcp/dhcpd.leases
   [ -x /sbin/restorecon ] && [ -d /selinux ] && /sbin/restorecon
/var/lib/dhcp/dhcpd.leases
fi
RETVAL=0
# Added By Barry # commented the following line(origconfig)
#prog="dhcpd"
# Added by Barry
prog= dhcpd -p $DHCPORT

configtest()
{
        CFA=''
        if [[ "$DHCPDARGS" = *-cf* ]]; then
	    CFA=`echo $DHCPDARGS | sed 's/^.*-cf[\ \	]*/-cf/;s/[\
\	].*$//;s/-cf/-cf /'`;
        fi;
	/usr/sbin/dhcpd -q -t $CFA
	return $?
}

start() {
	# Start daemons.
	echo -n $"Starting $prog: "
	daemon /usr/sbin/dhcpd ${DHCPDARGS} 2>/dev/null
	RETVAL=$?
	echo
	if [ $RETVAL -eq 0 ]; then
	    touch /var/lock/subsys/dhcpd
	    if [ -x /usr/bin/logger ]; then
		/usr/bin/logger -t dhcpd 'dhcpd startup succeeded'
	    fi;
	else
	    if [ -x /usr/bin/logger ]; then
		/usr/bin/logger -t dhcpd 'dhcpd startup failed'
	    fi;
        fi
	return $RETVAL
}

stop() {
	# Stop daemons.
	echo -n $"Shutting down $prog: "
	killproc dhcpd
	RETVAL=$?
	echo
	if [ $RETVAL -eq 0 ]; then
           rm -f /var/lock/subsys/dhcpd
	   if [ -x /usr/bin/logger ]; then
		/usr/bin/logger -t dhcpd 'dhcpd shutdown succeeded'
	   fi;
	else
	   if [ -x /usr/bin/logger ]; then
		/usr/bin/logger -t dhcpd 'dhcpd shutdown failed'
	   fi;
	fi
	return $RETVAL
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	configtest || exit $?
	stop
	start
	RETVAL=$?
	;;
  condrestart)
	if [ -f /var/lock/subsys/dhcpd ]; then
	    stop
	    start
	    RETVAL=$?
	fi
	;;
  configtest)
	configtest
	RETVAL=$?
	;;
  status)
	status dhcpd
	RETVAL=$?
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
	exit 1
esac

exit $RETVAL

--------------------------------------------------------------------------
You can see the lines i edited to make dhcp work on port 1067.( I have to
do this to remind myself how i made it work. I'm getting too old!).
There are only two lines you need to change in the dhcpd.sh file
Make sure the permissions on this file is 755 when you drop or edit your
dhcpd.sh file into the /etc/init.d folder.!!!!

Hope this helps.

Barry Cisna
westcentral school




More information about the K12OSN mailing list