Jump toUpdate content

How to configure an IPv6 subnet on a Dedibox running Linux

Reviewed on 03 August 2021Published on 03 August 2021
Requirements:
Important:
  • Make sure you have configured the DHCPv6 client on your system before setting up the network configuration.
  • Make sure IPv6 SLAAC is enabled on servers supporting this feature.

How to configure IPv6 on Debian

  1. Open the network configuration file /etc/network/interfaces in a text editor and edit it as follows:

    auto eno1
    iface eno1 inet6 static
    address IPV6ADDRESS
    netmask PREFIXLENGTH

    Remember to replace eno1 with the proper Internet interface name.

  2. Restart the network:

    sudo systemctl restart networking
Tip:

The network interface is initialized with the command allow-hotplug by default on Debian 9. It is possible that the network restart fails with this configuration. In this case, you can initialize the network with auto to avoid the problem.

How to configure IPv6 on Debian without systemd

If you do not want to use systemd to start your services, use the following configuration.

  1. Open the network configuration file /etc/network/interfaces in a text editor and edit it as follows:

    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

    Adapt the interface name (eno1) to your needs, as well as the IPv6 address and the netmask.

  2. Restart the network:

    sudo systemctl restart networking

How to configure IPv6 on Ubuntu

Ubuntu uses netplan since the release of Ubuntu 18.04 LTS as network configuration tool. It replaces the classical network configuration with new configuration files, written in YAML format, and located in the /etc/netplan directory. For more information regarding netplan, refer to the official documentation.

  1. Open the default configuration file /etc/netplan/01-netcfg.yaml in a text editor, and edit it as follows:

    # This file describes the network interfaces available on your system
    # For more information, see netplan(5).
    network:
    version: 2
    renderer: networkd
    ethernets:
    enp1s0:
    dhcp4: no
    dhcp6: no
    addresses:
    - "aaa.bbb.ccc.ddd/24" # The main IP address of your Dedibox server
    - "<IPv6_FROM_YOUR_BLOCK>/<SUBNETMASK>" # An IP address from your IPv6 block and it's subnet mask
    gateway4: aaa.bbb.ccc.1 # The gateway is the IP address of your Dedibox, ending on .1
    nameservers:
    addresses: [62.210.16.6, 62.210.16.7]
    routes:
    - to: 0.0.0.0
    via: aaa.bbb.ccc.1
    on-link: true

    Remember to replace enp1s0 with the proper name of your Internet interface.

  2. Check and validate your configuration file.

    sudo netplan –debug
  3. Activate the new configuration:

    sudo netplan apply

How to configure IPv6 on CentOS

  1. Open the automatically generated configuration file for your Internet interface in a text editor, for example /etc/sysconfig/network-scripts/ifcfg-eth0 and edit it as follows:

    # 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"
  2. Restart the networking service:

    systemctl restart network.service
Tip:

If your network connections are managed by the Network Manager, use the nmtui tool to configure IPv6 from a text user interface.

See Also