Login ing ISC dhcpv6 Server
Contents [Hide]
- 1 Preface
- 1.1 stateless Configuration
- 1.2 stateful Configuration
- 2 Installation
- 2.1 softwaredownload
- 2.2 sampleconfigurations
- 3 serverconfiguration
- 3.1 preconfigurationsteps
- 3.2 adding the serverinterface to your subnet
- 3.3 The expected IP Flow
- 3.4 DHCP server configfiles (create a range)
- 3.4.1 stateful Configuration
- 4 starting the server
- 4.1 manually
- 4.2 automatically with/etc/init. d/
- 5 Lets start the engine
|
Preface
This article shoshould give you a short overview how to install a dhcpv6 server and configure it.
With dhcpv6 you can decide in which mode you want to use your
DHCP server. You can use a 'stateless 'or 'stateful mode'. Both are
Described in this article below
Stateless Configuration
In stateless configuration mode the DHCP server interacts together
With an other IPv6 address assignment Mechanic (e.g. A radvd router ).
The client first gets its prefix (and generates his own IPv6 address-
Slaac) and ipves some more informations (like DNS server IPs, NTP
Server)
As second part from your dhcpv6 server.
In this mode the dhcpv6 server provides the following informations to clients:
DNS serveraddresses Domain Name NTP Server SIP Server (RFC 3319)... see http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml
Stateful Configuration
In this mode the dhcpv6 server provides their addresses without any other address assigning mechanic.
Installation
Softwaredownload
You can download the current production release of isc dhcp server from http://www.isc.org/software/dhcp. Single steps for installation are listed in file readme.
If you want to see my steps, look below:
wget http://ftp.isc.org/isc/dhcp/dhcp-4.2.1-P1.tar.gz tar -zxfv dhcp-4.2.1-P1.tar.gz cd dhcp-4.2.1-P1 ./configure make && make install
Sampleconfigurations
The folder "dhcp-4.2.1-P1/docs/Examples" provides some sampleconfigs, who are already ented very well.
Serverconfiguration
Preconfigurationsteps
A possible configuration cocould look like this:
1.) prefix '2017: ed8: 77b5 '(here you can use your sixxs prefix)
2) to indicate the DHCP server in IPv6 choose an 'easy to read'
Ipv4-in-ipv6 address: 2001: ed8: 77b5: 10: 123: 105: 122 (IPv4:
10.123.105.122/24)
3.) The DHCP range starts from 2001: ed8: 77b5: 1 to 2001: ed8: 77b5: FFFF (invalid addresses ...)
|
Client |
Server |
HW Mac |
00: 22: 68: 11: 62: CD |
60: EB: 69: 4E: 2b: 8b |
Link local address |
Fe80: 222: 68ff: Fe: 11: 62cd |
Fe80: 62eb: 69ff: fe4e: 2b8b |
IP |
Range 2001: ed8: 77b5: 1 2001: ed8: 77b5: FFFF |
2001: ed8: 77b5: 10: 123: 105: 122/64 |
Sixxs |
Range <YOUR-PREFIX >:: 1 <YOUR-PREFIX >:: FFFF: FFFF |
<YOUR-PREFIX>: 10: 123: 105: 122/64 |
Adding the serverinterface to your subnet
To become the server work properly, the listening interface has to be
Configured with a IP address in the provided subnet-otherwise
Server will not start.
(With this address the server knows, which interface he shocould use .)
There exists two methodes to configure your interface with IPv6 addresses:
Ifconfig
ifconfig <INTERFACE> inet6 {add|del} <IPV6-ADDRESS>/<PREFIX-LENGTH>example (for adding a address):ifconfig eth0 inet6 add 2001:ed8:77b5::10:123:105:122/64
IP
ip -6 addr {add|del} <IPV6-ADDRESS>/<PREFIX-LENGTH> dev <INTERFACE> exampleip -6 addr add 2001:ed8:77b5::10:123:105:122/64 dev eth0
The expected IP Flow
Keep in mind, that the IPv6 DHCP Client communicates always with
'All multicast node' (ff02: 1: 1, ff02: 1: 2) as destination address.
The server always communicates with his local link address (fe80: :)
Source Address.
At first look it's a little bit confusing, but the IP flow looks like this:
(Taken from whireshark's IP flow view)
Client DHCP Serverfe80::222:68ff:fe11:62cd fe80::62eb:69ff:fe4e:2b8b| || (all nodes address) || ff02::1:2 || | | | | || Solicit XID: 0x28d6 | | DHCPv6: Solicit XID: 0x28d6e4 CID: 0001000115ad822e0022681162cd |---------------------------->| || | || | || Advertise XID: 0x28 | | DHCPv6: Advertise XID: 0x28d6e4 IAA: 2001:ed8:77b5::8758:1493 CID: 0001000115ad822e0022681162cd |<---------------------------------------------------------|| | || | || Request XID: 0x35a2 | | DHCPv6: Request XID: 0x35a211 CID: 0001000115ad822e0022681162cd IAA: 2001:ed8:77b5::8758:1493 | --------------------------->| || | || | || Reply XID: 0x35a211 | | DHCPv6: Reply XID: 0x35a211 IAA: 2001:ed8:77b5::8758:1493 CID: 0001000115ad822e0022681162cd |<---------------------------------------------------------|
DHCP server configfiles (create a range)
Stateful Configuration
default-lease-time 2592000;preferred-lifetime 604800;option dhcp-renewal-time 3600;option dhcp-rebinding-time 7200;# Enable RFC 5007 support (same than for DHCPv4)allow leasequery;# Global definitions for name server address(es) and domain search list## option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:3f3e;option dhcp6.domain-search "test.example.com","example.com";option dhcp6.info-refresh-time 21600;# The subnet where the server is attachedsubnet6 2001:ed8:77b5::/64 {range6 2001:ed8:77b5::1 2001:ed8:77b5::ffff:ffff;}
Starting the server
Manually
You can start the server with the following command:
dhcpd -6 -cf <PATH-to-configfile> -ls <PATH-to-leasefile>
Automatically with/etc/init. d/
Here you can see my script to start the dhcpv6 server automatically
At boottime. I use Ubuntu, feel free to adopt this script for your
Purpose.
#!/bin/sh## $Id: isc dhcp server.init.d,v 4.2.1-P1 2011/04/05 /usr/local/sbin/dhcpd$#### BEGIN INIT INFO# Provides: dhcpd-server# Required-Start: $remote_fs $network $syslog# Required-Stop: $remote_fs $network $syslog# Should-Start: $local_fs slapd# Should-Stop: $local_fs slapd# Default-Start: 2 3 4 5# Default-Stop: 1# Short-Description: DHCP server# Description: Dynamic Host Configuration Protocol Server### END INIT INFOPATH=/sbin:/bin:/usr/sbin:/usr/bin# config fileNAME=dhcpdv6DESC="DHCP IPv6 server"INTERFACES="eth0"SERVER=/usr/local/sbin/dhcpdSERVERARGS="-6"CONFIGFILE=/etc/dhcpdv6/dhcpv6.confLIBFOLDER=/var/lib/dhcpv6LEASEFILE="${LIBFOLDER}/dhcpdv6.leases"RUNFOLDER=/var/run/dhcpv6DHCPDPID="${RUNFOLDER}/dhcpdv6.pid"# check filetypes/valuestest -f "${SERVER}" || exit 0# include all init functions. /lib/lsb/init-functionstest_config(){# 1.) check configif [ ! "${SERVER}" "${SERVERARGS}" -t -q -cf "${CONFIGFILE}" > /dev/null 2>&1 ]; thenecho "${NAME} self-test failed. Please fix the config file."echo "The error was: ""${SERVER}" "${SERVERARGS}" -t -cf "${CONFIGFILE}"exit 1fi# 2.) test_config will started if someone wants to start the server# test if the server is currently runningif [ "${1}" = "start" ]; thenif [ -e "${DHCPDPID}" ]; then stop_server "Currently running instance of ${DESC} found (PID: `cat ${DHCPDPID}`) - will now stop this instance"fifi}stop_server(){if [ "${1}" != "" ]; then log_daemon_msg "${1}"fiif [ -e "${DHCPDPID}" ]; then log_daemon_msg "Stopping ${DESC} ${NAME} [`cat ${DHCPDPID}`]" start-stop-daemon --stop --quiet --pidfile "${DHCPDPID}" log_end_msg $? rm -f "${DHCPDPID}"else log_daemon_msg "Stopping ${DESC} ${NAME}: nothing do do, no pidfile found"fi}# single arg is -v for messages, -q for nonecheck_status(){ if [ ! -r "$DHCPDPID" ]; then test "$1" != -v || echo "$NAME is not running." return 3 fi if read pid < "$DHCPDPID" && ps -p "$pid" > /dev/null 2>&1; then test "$1" != -v || echo "$NAME is running." return 0 else test "$1" != -v || echo "$NAME is not running but $DHCPDPID exists." return 1 fi}case "$1" instart) test_config ${1}log_daemon_msg "Starting ${DESC} ${NAME}"# allow dhcp server to write lease and pid fileif [ ! -e "${RUNFOLDER}" ]; then # create run folder mkdir -p "${RUNFOLDER}" chown dhcpd:dhcpd "${RUNFOLDER}" # create pid file touch "${DHCPDPID}" chown dhcpd:dhcpd "${DHCPDPID}"else # create pid file touch "${DHCPDPID}" chown dhcpd:dhcpd "${DHCPDPID}"fiif [ ! -e "${LIBFOLDER}" ]; then # create run folder mkdir -p "${LIBFOLDER}" chown dhcpd:dhcpd "${LIBFOLDER}" # create lease file touch "${LEASEFILE}" chown dhcpd:dhcpd "${LEASEFILE}"else # create pid file touch "${LEASEFILE}" chown dhcpd:dhcpd "${LEASEFILE}"fistart-stop-daemon --start --quiet --pidfile "${DHCPDPID}" --exec "${SERVER}" -- "${SERVERARGS}" -q -pf "${DHCPDPID}" -cf "${CONFIGFILE}" -lf "${LEASEFILE}" "${INTERFACES}"sleep 2if check_status -q; then log_end_msg 0elselog_failure_msg "check syslog for diagnostics."log_end_msg 1exit 1fi;;stop)# stop dhcp serverstop_server;;restart | force-reload)test_config$0 stopsleep 2$0 startif [ "$?" != "0" ]; thenexit 1fi;;status)echo -n "Status of $DESC: "check_status -vexit "$?";;*)echo "Usage: $0 {start|stop|restart|force-reload|status}"exit 1 esacexit 0
Don't forget to configure your runlevels, to really start the server if your machine starts:
update-rc.d <FILE-above> defaults
Lets start the engine
Now you lets start your DHCP Client and see the magic of dhcpv6 .:-)
For example:
The Network-Manager-gnome supports dhcpv6 as client
Categories: grouping ing ISC dhcpv6 server | how