IPv4 & IPv6 Client Addresses via DHCP

FreeBSD's base DHCP dhclient client does not support acquiring an IPv6 IP address via DHCP.

This article details how to install the dual-dhclient port to be able to acquire both an IPv4 and IPv6 address via DHCP servers on a dual-stack network.

To accomplish this the dual-dhclient port provides a script which spawns separate instances of dhclient.

  1. FreeBSD's base dhclient /sbin/dhclient for DHCPv4
  2. ISC's dhclient /usr/local/sbin/dhclient -6 for DHCPv6

 

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 configure the interface for IPv6 DHCP and router advertisements substituting em0 with your network interface:

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

 

The default dual-dhclient scripts uses a command line option that forces ISC's dhclient to use no configuration file. Removing -cf /dev/null from the command line re-enables the use of the configuration file which defaults to /usr/local/etc/dhclient.conf

Edit /usr/local/sbin/dual-dhclient removing -cf /dev/null from the bottom command line:

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

 

Delete and create a new /usr/local/etc/dhclient.conf configuration file. The dhclient.conf file that is installed with isc-dhcp44-client is an exact copy of dhclient.conf.example. The example configuration should not be used when invoking ISC's dhclient on a live system.

Edit a new /usr/local/etc/dhclient.conf with the following configuration:

send fqdn.fqdn = gethostname();
request dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn;

 

Reboot and check if the interface acquired both DHCP addresses.
For troubleshooting check relevant logs.
DHCP IPv6 Lease File: /var/db/dhclient6.leases