NavigationContentFooter
Jump toSuggest an edit

How to configure IPv6 connectivity using systemd-networkd

Reviewed on 21 October 2024Published on 03 August 2021

Before you start

To complete the actions presented below, you must have:

  • A Dedibox account logged into the console
  • A Dedibox dedicated server
  • Requested a /48 IPv6 prefix
Note

Follow the IPv6 on Ubuntu configuration if you are on Ubuntu and use Netplan as your default network manager. Follow the IPv6 on Linux configuration with systemd-networkd if you are on another Linux distribution or prefer to use directly systemd-networkd on Ubuntu.

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
    - "2001:bc8:xxxx:xxx::x/64" # An IP address from your IPv6 block and its subnet mask /64, replace placeholder values
    gateway4: aaa.bbb.ccc.1 # The gateway is the IPv4 address of your Dedibox, ending on .1
    nameservers:
    addresses: [ "51.159.47.28", "51.159.47.26" ] # Replace the IP of the DNS cache server with the one located in the same physical location as your machine for optimal performances (https://www.scaleway.com/en/docs/console/account/reference-content/scaleway-network-information/#dns-cache-servers)
    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.

    Note

    The configuration example above is valid for the main IP address of your Dedibox server. If you want to use IPv6 on a virtual machine, remember to use the unique gateway for the failover IPv4.

  2. Check and validate your configuration file.

    sudo netplan –debug
  3. Activate the new configuration:

    sudo netplan apply

How to configure IPv6 on Linux with systemd-networkd

systemd-networkd is the network manager of systemd. It is provided natively on most Linux distributions and can be used for the configuration of IPv6 with its DHCPv6 client feature.

Tip

When specifying the IP address of your Dedibox, you need to enter it in CIDR notation. The netmask for the main IPv4 of a Dedibox server is /24, the netmask for a failover IPv4 is /32. The netmask for the IPv6 is /64.

  1. Run the ip link show command to find the name of your public internet interface. Make sure to store it, as it will be required in the next steps.
  2. Run the following command to create a backup of the current network configuration and configure systemd-networkd:
    sudo mv /etc/systemd/network/eno1.network /etc/systemd/network/eno1.network.bkp
  3. Run the following command to enable systemd-networkd.
    systemctl enable systemd-networkd.service
  4. Create a new file called <interface_name>.network and open it in a text editor.
    sudo nano /etc/systemd/network/eno1.network
  5. Open the file in a text editor and paste the following content. Make sure to replace the values in the example with your own and save them before exiting the text editor.
    [Match]
    #The name must correspond to your interface name
    Name=eno1
    [Network]
    DHCP=ipv6
    IPv6AcceptRA=yes
    # IPv4 of the Dedibox, change netmask to /32 if failover IPv4
    Address=<ipv4_of_your_dedibox>/24
    # IPv6 of the Dedibox
    Address=2001:bc8:xxxx:xxx::x/64
    [Route]
    # The IPv4 gateway is either your Dedibox IP ending on .1 (i.e. x.y.z.1) for the physical host or 62.210.0.1 for any VM running on a Dedibox
    Gateway=<gateway_ipv4>
    GatewayOnlink=yes
    [DHCP]
    ClientIdentifier=duid-only
    DUIDType=link-layer
    # Scaleway Dedibox DUID without the DUID-LL "00:03" at the beginning
    DUIDRawData=<Scaleway IPv6 DUID>
    [DHCPv6]
    UseAddress=no
    WithoutRA=solicit
    [IPv6AcceptRA]
    DHCPv6Client=always
    UseOnLinkPrefix=False
    UseAutonomousPrefix=False
  6. Run the following command to activate the new configuration.
    systemctl start systemd-networkd
See also
How to enable IPv6 SLAACHow to configure IPv6 on Windows
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway