IPv4 and IPv6 Client Addresses via DHCP on a Dual-Stack Network

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 /usr/local/etc/dhclient.conf. It is installed with isc-dhcp44-client but is an exact copy of dhclient.conf.example. Furthermore this example is just that, an "example" that should not be used when invoking ISC's dhclient on a live system. Once deleted, create and 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, dhcp6.sntp-servers;

 

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