[pkg-dhcp-devel] Bug#741530: Multiple dhcp instances
Dominique Fournier
dominique.fournier at grenoble.cnrs.fr
Thu Mar 13 14:04:39 UTC 2014
Package: isc-dhcp-relay
Version: 4.2.2.dfsg.1-5+deb70u6
Hi
I need to have multiple instances of dhcp-relay (each VLAN on my
firewall can have a different instance, with a dedicated DHCP server).
I adapt the launch script to do that :
===== START OF /etc/init.d/isc-dhcp-relay ====
#!/bin/sh
#
#
### BEGIN INIT INFO
# Provides: isc-dhcp-relay
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: DHCP relay
# Description: Dynamic Host Configuration Protocol Relay
### END INIT INFO
# It is not safe to start if we don't have a default configuration...
if [ ! -f /etc/default/isc-dhcp-relay ]; then
echo "/etc/default/isc-dhcp-relay does not exist! - Aborting..."
echo "Run 'dpkg-reconfigure isc-dhcp-relay' to fix the problem."
exit 1
fi
case "$1" in
start)
for file in `ls /etc/default/isc-dhcp-relay*`; do
SERVERS=""
INTERFACES=""
OPTIONS=""
. $file
file=`basename $file`
echo $file
DHCRELAYPID=/var/run/dhcrelay-$file.pid
OPTIONS="$OPTIONS -pf $DHCRELAYPID"
# Build command line for interfaces (will be
passed to dhrelay below.)
IFCMD=""
if test "$INTERFACES" != ""; then
for I in $INTERFACES; do
IFCMD=${IFCMD}"-i "${I}" "
done
fi
start-stop-daemon --start --quiet --pidfile
$DHCRELAYPID \
--exec /usr/sbin/dhcrelay -- -q
$OPTIONS $IFCMD $SERVERS
done
;;
stop)
for file in `ls /etc/default/isc-dhcp-relay*`; do
file=`basename $file`
echo $file
DHCRELAYPID=/var/run/dhcrelay-$file.pid
start-stop-daemon --stop --quiet
--pidfile $DHCRELAYPID
done
;;
restart | force-reload)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: /etc/init.d/isc-dhcp-relay
{start|stop|restart|force-reload}"
exit 1
esac
exit 0
======== END OF FILE =======
You can create multiple /etc/default/isc-dhcp-relay files with different
extensions.
Thanks a lot !
Dom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dominique_fournier.vcf
Type: text/x-vcard
Size: 174 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-dhcp-devel/attachments/20140313/3267586a/attachment.vcf>
More information about the pkg-dhcp-devel
mailing list