Skip to content

Instantly share code, notes, and snippets.

@drscream
Forked from wiedi/gist:dfb22881eafef151ea94
Last active August 29, 2015 14:04
Show Gist options
  • Save drscream/13d3b2e350d54e880bf1 to your computer and use it in GitHub Desktop.
Save drscream/13d3b2e350d54e880bf1 to your computer and use it in GitHub Desktop.
pkgin install isc-dhcpd
#####
cat > /opt/local/etc/dhcp/dhcpd.conf <
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet6 fdad:e34f:f1d0::/64 {
# Range for clients
range6 fdad:e34f:f1d0::1000 fdad:e34f:f1d0::ffff;
# Additional options
option dhcp6.name-servers 2001:4860:4860::8888;
}
###### ------
modify /opt/local/lib/svc/method/isc-dhcpd so it starts with -6
/usr/sbin/svcadm enable svc:/pkgsrc/isc-dhcpd:default
#!/sbin/sh
#
# $NetBSD: isc-dhcpd6.sh,v 1.1 2014/03/12 14:29:31 jperkin Exp $
#
# Init script for isc-dhcpd.
#
case "$1" in
start)
if [ ! -d /var/db/isc-dhcp ]; then
mkdir -p /var/db/isc-dhcp
touch /var/db/isc-dhcp/dhcpd6.leases
chmod 0640 /var/db/isc-dhcp/dhcpd6.leases
fi
mkdir -p /var/run/isc-dhcp
chmod 0770 /var/run/isc-dhcp
/opt/local/sbin/dhcpd -6 -pf /var/run/isc-dhcp/isc-dhcpd6.pid -cf /opt/local/etc/dhcp/dhcpd6.conf
;;
stop)
if [ -s /var/run/isc-dhcp/isc-dhcpd6.pid ]; then
kill `cat /var/run/isc-dhcp/isc-dhcpd6.pid`
fi
;;
refresh)
$0 stop
$0 start
;;
esac
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='pkgsrc/isc-dhcpd6' type='service' version='0'>
<create_default_instance enabled='true'/>
<single_instance/>
<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default'/>
</dependency>
<dependency name='filesystem-local' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local:default'/>
</dependency>
<method_context>
<method_credential group='root' user='root'/>
</method_context>
<exec_method name='start' type='method' exec='/opt/local/lib/svc/method/isc-dhcpd6 start' timeout_seconds='30'/>
<exec_method name='stop' type='method' exec='/opt/local/lib/svc/method/isc-dhcpd6 stop' timeout_seconds='30'/>
<exec_method name='refresh' type='method' exec='/opt/local/lib/svc/method/isc-dhcpd6 refresh' timeout_seconds='30'/>
<template>
<common_name>
<loctext xml:lang='C'>ISC DHCPv6 Server</loctext>
</common_name>
</template>
</service>
</service_bundle>
@drscream
Copy link
Author

  1. Place isc-dhcpd6 in /opt/local/lib/svc/method.
  2. svccfg import isc-dhcpd6.xml
  3. Make sure you've a valid dhcpd6.conf in /opt/local/etc/dhcp/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment