How to configure IPv6 connectivitiy using networkd
Published on 03 August 2021
Requirements:
- You have an account and are logged into the Dedibox console
- You have created a Dedibox dedicated server
- You have requested a /48 IPv6 prefix
networkd
is the network manager of systemd and can be used as an alternative to the configuration of IPv6 using a standalone DHCP client.
Tip:
When specifying the IP address of your Dedibox, you need to enter it in CIDR notation. The netmask for the main IP of a Dedibox server is /24
, the netmask for a failover IP is /32
.
- To configure
networkd
, start by creating a backup of the current network configuration:sudo mv /etc/network/interfaces /etc/network/interfaces.backup
- Enable
networkd
by using the systemctl command. Do not start the service yet, as the server is currently still running on the old configuration and may become unreachable if networkd is started at this step.systemctl enable systemd-networkd.service
- Create a new file called
dummy0.netdev
in the/etc/systemd/network
directory and open it in a text editor, i.e.nano
.sudo nano /etc/systemd/network/dummy0.netdev
- Copy the following content into the file, save it, and exit the text editor:
[NetDev]
Name=dummy0
Kind=dummy - Create a new file
dummy0.network
and open it in nano:sudo nano /etc/systemd/network/dummy0.network
- Copy the following content into the file, save it and exit the text editor:
[Match]
Name=dummy0
[Network]
IPv6PrefixDelegation=dhcpv6 - Find the name of your public Internet interface using the
ip link show
command. In this example, the name of the interface isenp1s0f0
. Take a note of it, as it will be required in the next steps. - Create a new file called
<interface_name>.network
and open it in a text editorsudo nano /etc/systemd/network/enp1s0f0.network
- Copy the following content in the file, edit it towards your configuration before saving the file and exiting the text editor.
[Match]
#The name must correspond to your interface name
Name=enp1s0
[Network]
DHCP=ipv6
IPv6AcceptRA=True
# IPv4 of the Dedibox
Address=<ip_of_your_dedibox>/<netmask>
# IPv6 of the Dedibox
Address=<your_ipv6_address>/<netmask>
[Route]
# The 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_ip>
GatewayOnlink=yes
[DHCP]
ClientIdentifier=duid-only
DUIDType=link-layer
# Onine by Scaleway DUID without 00:03 at the begginnig
DUIDRawData=<Online by Scaleway DUID>
ForceDHCPv6PDOtherInformation=yes
[IPv6AcceptRA]
UseOnLinkPrefix=False
UseAutonomousPrefix=False - Reboot the machine to activate the new configuration.
sudo reboot
See Also