FreeBSD's builtin DHCP client does not support acquiring an IPv6 address via DHCP.
This article details how to install and configure the dual-dhclient port to be able to acquire both an IPv4 and IPv6 address via DHCP servers on a dual-stack network.
Install net/dual-dhclient using your preferred method.
dual-dhclient depends on net/isc-dhcp44-client which will also be installed.
/etc/rc.conf to enable and configure your interface for IPv6 DHCP and router advertisements. Substitute em0 with your network interface:
dhclient_program="/usr/local/sbin/dual-dhclient" ifconfig_em0="DHCP" ifconfig_em0_ipv6="inet6 DHCP accept_rtadv"
/usr/local/sbin/dual-dhclient changing both command lines as follows:
/usr/local/sbin/dhclient "$@" /usr/local/sbin/dhclient -6 -nw -D LL "$@"
An informational note regarding command line option
-D LL: By default ISC's dhclient will initially construct a IPv6 DUID client identifier based on the link-layer address plus a timestamp (DUID-LLT). Adding
-D LL to the command line instructs dhclient to instead create a DUID based on the link-layer address without the timestamp (DUID-LL). This means that dhclient will always construct the exact same DUID even if the lease file
/var/db/dhclient6.leases is deleted. A consistent DUID is necessary to allow DDNS name server updates to succeed.
The default dhclient configuration file
/usr/local/etc/dhclient.conf is a copy of
/usr/local/etc/dhclient.conf.example. This example configuration, and therefore the default
dhclient.conf file should not be used on a production system.
Delete then edit a new
/usr/local/etc/dhclient.conf file with the following configuration:
send fqdn.fqdn = gethostname();
If you prefer to have dhclient attempt to do the DDNS update instead of the DHCP server (preferred), then also include the following configuration options:
send fqdn.encoded on; send fqdn.server-update off; also request fqdn, dhcp6.fqdn;
Kill any running dhclient processes:
dual-dhclient to launch the two instances of dhclient.
ifconfig to check if the interface acquired both DHCP IP addresses.
To specifically view the isc-dhcp44-client man pages versus the identically named FreeBSD base system versions, specify the manpath:
man -M /usr/local/man/ dhclient
Leases acquired by the client are written to the following files:
DHCP IPv4 lease file:
DHCP IPv6 lease file: