====== DHCPv6 ====== The big downside of IPv6 addresses is their length. While manually configured addresses can be chosen to allow for a short textual representation by using the ''::'' abbreviation, using auto-configuration tends to produce addresses which are quite the opposite - constructing a 64bit host part by expansion of the 48bit MAC address renders even the shortest prefix nearly unrecognizable. Using DHCPv6 might cause relief to this misery due to it's possibility to have a static lease for identified hosts. This is how to get things going. ===== ISC DHCPD Setup ===== Sadly, it is not possible for now to use the same instance of ''dhcpd'' for both IPv4 and IPv6 address configuration. Therefore one has to maintain a separate //dhcpd6.conf//, as well. option domain-name "ip6.local"; default-lease-time 600; max-lease-time 7200; authoritative; subnet6 dead:beef::/64 { range6 dead:beef::1000 dead:beef::ffff; } host workstation { host-identifier option dhcp6.client-id 00:01:00:01:1c:42:94:23:00:ff:17:0b:ac:49; fixed-address6 dead:beef::3; } The above config will dynamically assign addresses in the prefix ''dead:beef::/64'', with host parts from ''1000'' till ''ffff''. The host named ''workstation'' (only by ''dhcpd'', not anywhere else) gets ''dead:beef::3'' iff it identifies correctly (see below). Start the dedicated ''dhcpd'' for IPv6 like so: dhcpd -6 -cf /etc/dhcpd6.conf ===== DHCPCD Setup ===== The scope of this article covers using ''dhcpcd'' as DHCP client only, not least because it is able to simultaneously configure an interface with IPv4 and IPv6 address. 00:01:00:01:1c:42:94:23:00:ff:17:0b:ac:49 The above file should exist in every system where ''dhcpcd'' is installed. If not, one might just create it - it's contents are supposed to be rather random, with focus on hopefully having a unique DUID for every host in the same network. Firing up ''dhcpcd'' is then as easy as this: dhcpcd ===== Combining with Stateless Auto-Configuration ===== Since one can't assume every host joining the network to implement DHCPv6 (yet), it is desirable to offer stateless auto-configuration as well. This is surprisingly easy, only two additional lines have to be added to //radvd.conf// to make ''radvd'' and ''dhcpd'' get along with each other: interface { AdvSendAdvert on; # here we go AdvManagedFlag on; AdvOtherConfigFlag on; prefix dead:beef::/64 { AdvOnLink on; AdvAutonomous on; AdvRouterAddr off; }; RDNSS dead:beef::1 { AdvRDNSSLifetime 86400; }; }; First things first, standard stateless auto-config options above: ''radvd'' is told to advertise the prefix ''dead:beef::/64'' for autonomous configuration on interface ''''. Besides, ''dead:beef::1'' is advertised as nameserver to use. Now for the interesting part: ''AdvManagedFlag'' signals hosts to use stateful auto-configuration in addition to the stateless configured ones. ''AdvOtherConfigFlag'' enables the same for non-address information. As the attentive reader might have guessed already, just adding the above two lines to //radvd.conf// leads to DHCPv6-aware hosts assigning a stateful **as well as** a stateless address to the configured interface, at least when using ''dhcpcd''. This might even be called a feature, as it makes ''dhcpcd'' establish a working interface configuration no matter what style of auto-configuration is necessary. On the other hand, I have not found a way to tell ''dhcpcd'' to prefer stateful over stateless and fall back to the later only if no DHCPv6 lease was received in time. From this point of view the behaviour is rather that of a bug than anything else. At least it is possible though to turn stateless auto-configuration off in ''dhcpcd'' by adding the following statement to //dhcpcd.conf//: ipv6ra_noautoconf If I wanted to configure the interface statelessly, I would not run ''dhcpcd'' in the first place, would I? ===== Notes ===== Remarkably, none of the ''autoconf'' or ''accept_ra'' sysctl settings have to be switched off in order for this to work.