userdoc:tt-dhcpv6-prefix-delegation

DHCPv6 with Prefix Delegation

AstLinux supports DHCPv6 with Prefix Delegation (DHCPv6-PD) to dynamically assign an IPv6 address to the external interface and optionally assign /64 prefixes to internal interfaces.

The DHCPv6 client daemon is provided by wide-dhcpv6 (with Debian patches) working together with dnsmasq.

Note: AstLinux 1.2.5 or later is required

Enable DHCPv6 client on the external interface as follows.

Select the Network Tab in the web interface.
Network Tab

External Interface: → Connection Type:
Select the proper entry containing: DHCPv6

The default DHCPv6 client settings are:
DHCPv6 Network Tab

The default settings should work for most situations. Though the supported values of “DHCPv6 Prefix Length” will vary. The default value of “60” will allow 16 [ie. 2^(64-60) ] unique /64 prefixes for local use.

When DHCPv6 Prefix Delegation is enabled, specify which internal interface(s) should get an automatic /64 prefix. You may enable for multiple interfaces provided the supplied DHCPv6 Prefix Length is less than 64.

Internal Interfaces: → Interface: → IPv6 Autoconfig:
Version -> AstLinux 1.2.5 to AstLinux 1.2.10 - IPv6/nn must be empty
DHCPv6 Internal Interface

Version -> AstLinux 1.3.0 and later - IPv6/nn may define a ULA/64 address, or be empty
DHCPv6 Internal Interface

Note -> A “Reboot System” is required to apply any changes related to DHCPv6.

Note: AstLinux 1.2.10 or later is required

Note: AstLinux 1.3.0 or later executes a default action, additional custom actions can enabled if a custom script is defined.

If an executable script exists at /mnt/kd/dhcp6c.script the dhcp6c daemon will call the script after a DHCPv6 request is processed.

In order to help coding a script, unique to AstLinux, the following environmental variables will be set when appropriate.

External interface and DHCPv6 assigned address:

dhcp6c_interface
dhcp6c_address

Prefix Delegation interfaces and associated IPv6 addresses, a comma-separated list for each:

dhcp6c_prefix_interfaces
dhcp6c_prefix_addresses

Assigned Prefix, ex. 2001:0db8:1750:2800::/56

dhcp6c_prefix

Prefix base string, ex. 2001:0db8:1750:28

dhcp6c_prefix_base

Prefix Length as a number, ex. 56

dhcp6c_prefix_len

Note -> Do not expect all the variables to be always defined, though if dhcp6c_prefix is defined then the complete set will be defined.

Lastly, an indication whether the DHCPv6 update was different from the previous update:

dhcp6c_changed

The dhcp6c_changed variable can be empty if there was no previous dhcp6c_cache file to compare, “yes” if different from previous, and “no” if the same as previous. The most common use case would be to compare dhcp6c_changed with “no” to skip operations that have been previously performed.

As an example, a simple script to log when the DHCPv6 lease is updated and whether it changed:
Note -> Occurs by default with AstLinux 1.3.0 or later

#!/bin/bash

case "$dhcp6c_changed" in
  yes) changed=" (changed)" ;;
   no) changed=" (no change)" ;;
    *) changed="" ;;
esac
logger -t dhcp6c -p kern.info "IPv6 Prefix$changed: $dhcp6c_prefix"

DHCP (DHCPv4) has been supported by ISP's in a standard way for a long time, but IPv6 is relatively new and DHCPv6 together with prefix delegation can be problematic. In order to diagnose a problem with your ISP it may be necessary to do some debugging from the CLI.

Debug example using an interactive CLI session, assuming the external interface (EXTIF) is eth0, edit accordingly if different:

/etc/ifplugd/dhcp6c.action eth0 down
dhcp6c -Df -c /etc/wide-dhcpv6/dhcp6c-eth0.conf -p /var/run/dhcp6c-eth0.pid eth0

The dhcp6c process now logs to terminal in foreground with verbose debugging enabled.

When finished, return to normal by …

^C
/etc/ifplugd/dhcp6c.action eth0 up
  • userdoc/tt-dhcpv6-prefix-delegation.txt
  • Last modified: 2017/06/07 10:20
  • by abelbeck