IPv4 & IPv6 Client Addresses via DHCP

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.

 

Edit /etc/rc.conf to enable and configure the interface for IPv6 DHCP and router advertisements. Substitute em0 with your network interface:

ipv6_activate_all_interfaces="YES"
dhclient_program="/usr/local/sbin/dual-dhclient" ifconfig_em0="DHCP" ifconfig_em0_ipv6="inet6 DHCP accept_rtadv"

 

Edit /usr/local/sbin/dual-dhclient changing both command lines as follows:

/usr/local/sbin/dhclient "$@"
/usr/local/sbin/dhclient -6 -nw "$@"

 

The default /usr/local/etc/dhclient.conf file that is installed with isc-dhcp44-client is a copy of dhclient.conf.example. This example configuration, and therefore the default dhclient.conf file should not be used on a live system.

Delete then edit a new /usr/local/etc/dhclient.conf file with the following configuration:

send fqdn.fqdn = gethostname();

 

Kill any running dhclient processes:
killall dhclient

Execute dual-dhclient to launch the two instances of dhclient, one for IPv4, and one for IPv6 DHCP.

Use ifconfig to check if the interface acquired both DHCP IP addresses.

 

For troubleshooting check relevant logs.

Leases acquired by the client are written to the following files:
DHCP IPv4 lease file: /var/db/dhclient.leases
DHCP IPv6 lease file: /var/db/dhclient6.leases