How to configure the DHCPV6 client

We will use dhclient.

You'll need to edit the following file /etc/dhcp/dhclient6.conf :

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

Start your DHCPv6 client at boot

Once the client is configured, you'll need to create a new SystemD service.

Create the following file, adapting the interface name (eth0) and the DUID /etc/systemd/system/dhclient.service:

[Unit]
Description=dhclient for sending DUID IPv6
Wants=network.target
Before=network.target

[Service]
Type=forking
ExecStart=/usr/sbin/dhclient -cf /etc/dhcp/dhclient6.conf -6 -P -v eth0

[Install]
WantedBy=multi-user.target
dhclient's path may vary depending on your OS. To know the exact path, use the following command: which dhclient

Then, enable it for every reboot: systemctl enable dhclient.service.

Configure the Network on Ubuntu 16 & Debian 8

The following commands have to be used as root or with sudo

Start by editing /etc/network/interfaces as follow:

iface eno1 inet6 static
    address IPV6ADDRESS
    netmask PREFIXLEN

You'll need to replace eno1 with the proper interface name.
With Debian & old versions of Ubuntu, it's usually eth0.

Alternate configuration without SystemD

If you don't use SystemD to start your services, you can configure your /etc/network/interfaces as follow:

iface eno1 inet6 static
    pre-up modprobe ipv6
    pre-up dhclient -cf /etc/dhcp/dhclient6.conf -6 -P -d -v $IFACE
    address IPV6ADDRESS
    netmask PREFIXLEN

Still adapting your interface name (eno1) to your needs, as well as the IPv6 address and the Netmask.

Configure the Network on CentOS 7

The following commands have to be used as root or with sudo

After configuring your dhclient and SystemD, you'll need to edit /etc/sysconfig/network-scripts/ifcfg-eth0:

# Generated by parse-kickstart
UUID=xxxxx
DNS1=62.210.16.6
BOOTPROTO=none
DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
IPADDR=62.210.xx.xx
PREFIX=24
GATEWAY=62.210.xx.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6ADDR="IPV6ADDRESS/PREFIXLEN" 
IPV6_AUTOCONF=yes
NAME="System eth0" 

Once done with the configuration, you can reboot your server to check that the service & the configuration are correctly applied at the boot!

You will need to allow in your firewall 546/UDP Incoming & 547/UDP Outgoing.

TEST YOUR CONFIGURATION

Launch the dhclient with the following command:

dhclient -cf /etc/dhcp/dhclient6.conf -6 -P -v eth0

To check your IPv6 connectivity, you can use the PING command:

ping6 ipv6.google.com

DEBUG

If the configuration is not working for you, check your interface name with the following command:

ifconfig -a

Also, your server need to be configured to accept RA (Router Advertisement).
By default, your server won't accept to forward packets from an interface to another if it's automatically configured (through DHCPv6).

If you need to forward IPv6 packets and use an automated configuration, you'll need to set your sysctl net.ipv6.conf.all.accept_ra to 2 in /etc/sysctl.conf.
This is useful usually for Hypervisor Host such as Proxmox.

The examples are given for eth0/eno1, if your main interface have a different name, you'll need to modify it in all of your configurations files.

Traffic limitation of your client

In certain cases, some DHCPv6 clients may unfortunately sends several requests per second (especially dchp6c).

This triggers blocking of your servers network port by our automatic protection, as it will be seen as a source of an UDP flood.

To avoid this problem, we invite you to limit the traffic sent from your dhclient6 directly in your firewall configuration.

Following an example for IPTABLES :

ip6tables -A OUTPUT -p udp --dport 547 -m limit --limit 10/min --limit-burst 5 -j ACCEPT
ip6tables -A OUTPUT -p udp --dport 547 -j DROP

In Rescue mode

To test the IPv6 on your server in rescue mode, reboot the server in rescue mode with the “Ubuntu 14 - Trusty” mode. The dhclient is already available on it.

Create the file which will contain your DUID.

nano /etc/dhcp/dhclient6.conf

First, start the dhclient:

dhclient -cf /etc/dhcp/dhclient6.conf -6 -P -v <interface>

After, add the IPv6 address to your network interface:

/sbin/ifconfig <interface> inet6 add IPV6ADDRESS/PREFIXLENGH

Then you can try to ping6:

ping6 ipv6.google.com
¿Fue útil la respuesta?

Artículos Relacionados

Network Configuration with Netplan on Ubuntu 18.04

 With the version 18.04 (Bionic Beaver) Ubuntu has switched to Netplan for the configuration of...