Configuring DHCPv6

As the IPv4 address space is now exhausted, all networking people are focusing on IPv6. In this post, I will explain how to configure DHCPv6 on a Linux machine running Ubuntu 11.04 server (64 bits) with the ISC DHCPv6 service. Be carefull, you need the version 4.x of the ISC DHCP server that support IPv6. It does not exist as a package for older Ubuntu version. The ISC version 4.1 and above superseed the DHCPv6 serveur.

Step 1: configure a fixed IPv6 address on your ethernet card
To specify a fixed (manual) IPv4/IPv6 address, you need to modify the file /etc/network/interfaces:
auto eth1
iface eth1 inet static
address 172.16.14.251
netmask 255.255.255.0
gateway 172.16.14.1
iface eth1 inet6 static
pre-up modprobe ipv6
address 2001:620:40b:555::4
netmask 64
gateway 2001:620:40b:555::1
Don’t forget to restart the networking service to take this configuration into account:
#/etc/init.d/networking restart
Step 2: install the DHCPv6 server

As of this writing, the version 4.1.1P1 of the ISC DHCP server is the actual package available on Ubuntu.
#apt-get install isc-dhcp-server
Step 3: configure the DHCPv6 server

The actual version of ISC does not allow to run one instance of ISC and support at the same time DHCPv4 and DHCPv6. You need to start two instances of DHCP, one for IPv4 and one for IPv6.

Be sure that your server will listen for DHCP request on the correct interface. Edit the /etc/default/isc-dhcp-server file:
INTERFACES="eth1"
Configure the IPv4 address Pool by editing/creating the /etc/dhcp/dhcpd.conf file:
option domain-name "buntschu.ch";
option domain-name-servers ns.buntschu.ch;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 172.16.14.0 netmask 255.255.255.0 {
range 172.16.14.100 172.16.14.110;}
Configure the IPv6 address Pool by editing/creating the /etc/dhcp/dhcpd6.conf file:
option domain-name "buntschu.ch";
option domain-name-servers ns.buntschu.ch;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet6 2001:620:40b:555::/64 {
range6 2001:620:40b:555::100 2001:620:40b:555::110;}
Create a second startup file for the DHCPv6 server
#cp /etc/init.d/isc-dhcp-server /etc/init.d/isc-dhcp6-server
#update-rc.d isc-dhcp6-server defaults
Modify the new file “/etc/init.d/isc-dhcp6-server” to support IPv6 by:
adding the “-6″ option everywhere the dhcpd process is called (3 times)
change all “dhcp.leases” with dhcp6.leases”
modify the CONFIG_FILE variable :
CONFIG_FILE=/etc/dhcp/dhcpd6.conf
modifiy the DHCPID variable:
DHCPDPID=/var/run/dhcp-server/dhcpd6.pid
The DHCP Deamon is controlled by the “apparmor”, so we need to authorize the DHCPv6 to create some files and access some others. Here are the lines to add to the “/etc/apparmor.d/usr.sbin.dhcpd” file:
...
network inet6 raw,
@{PROC}/[0-9]*/net/if_inet6 r,
/var/lib/dhcp/dhcpd6.leases* lrw,
/var/run/dhcp-server/dhcpd6.pid w,
...
Don’t forget to restart the “apparmor” process:
#/etc/init.d/apparmor restart
Your are now ready to start both servers !
#/etc/init.d/isc-dhcp-server start
#/etc/init.d/isc-dhcp6-server start

Happy playing with IPv6 !


原文地址:

http://www.buntschu.ch/blog/?p=344

你可能感兴趣的:(Configuring DHCPv6)