Jump toUpdate content

How to configure the DHCPv6 client

Reviewed on 03 August 2021Published on 03 August 2021
Requirements:
Important:

On servers supporting IPv6 SLAAC, SLAAC has to be enabled in order to ensure that DHCPv6 works correctly. If disabled, a server will not be able to learn its IPv6 default route.

Tip:

It is recommended to use the Internet Systems Consortium DHCP Client, dhclient as DHCP client for IPv6.

How to set the DUID of your subnet

  1. Log into your server using SSH.

  2. Open the file /etc/dhcp/dhclient6.conf in a text editor, for example: nano, and edit it as shown below:

    interface "eno1" {
    send dhcp6.client-id DUID;
    }

    Make sure to adapt the interface name (eno1) to the Internet interface name of your system and replace DUID with the DUID of your subnet.

How to autostart the DHCPv6 client during system boot

To enable automatic start of the DHCPv6 client during system boot, a SystemD service is required.

  1. Log into your server using SSH.

  2. Open the file /etc/systemd/system/dhclient.service in a text editor, for example: nano, and edit it as shown below:

    [Unit]
    Description=dhclient for sending DUID IPv6
    After=network-online.target
    Wants=network-online.target

    [Service]
    Restart=always
    RestartSec=10
    Type=forking
    ExecStart=/sbin/dhclient -cf /etc/dhcp/dhclient6.conf -6 -P -v eno1
    ExecStop=/sbin/dhclient -x -pf /var/run/dhclient6.pid

    [Install]
    WantedBy=network.target
    Tip:

    The path to the dhclient binaty may vary depending on your OS. To see the exact path for your system, use the following command: which dhclient.

  3. Enable the service so it will start at each reboot of the machine:

    sudo systemctl enable dhclient.service
See Also