How to configure IPv6 using networkd?
networkd
is the network manager of systemd and can be used as an alternative to the configuration of IPv6 using a standalone DHCP client.
When specifying the IP address of your Dedicated Server, you need to enter it in CIDR notation. The netmask for the main IP of a Dedicated Server is /24
, the netmask for a failover IP is /32
.
1. To configure networkd, start by creating a backup of the current network configuration:
sudo mv /etc/network/interfaces /etc/network/interfaces.backup
2. Enable the networkd by using the systemctl
command. Don't 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
3. 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
4. Copy the following content into the file, save it and exit the text editor:
[NetDev] Name=dummy0 Kind=dummy
5. Create a new file dummy0.network
and open it in nano:
sudo nano /etc/systemd/network/dummy0.network
6. Copy the following content into the file, save it and exit the text editor:
[Match] Name=dummy0 [Network] IPv6PrefixDelegation=dhcpv6
7. Find the name of your public internet interface using the ip link show
command and take a note of it. In this example, the name of the interface is enp1s0f0
. Take a note of it, as it will be required in the next steps.
8. Create a new file called <interface_name>.network
and open it in a text editor
sudo nano /etc/systemd/network/enp1s0f0.network
9. 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 Dedicated Server Address=<ip_of_your_server>/<netmask> # IPv6 of the Dedicated Server Address=<your_ipv6_address>/<netmask> [Route] # The gateway is either your Dedicated Servers 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 Dedicated Server Gateway=<gateway_ip> GatewayOnlink=yes [DHCP] ClientIdentifier=duid-only DUIDType=link-layer # CloudLinkd DUID without 00:03 at the beginning DUIDRawData=<CloudLinkd DUID> ForceDHCPv6PDOtherInformation=yes [IPv6AcceptRA] UseOnLinkPrefix=False UseAutonomousPrefix=False
10. Reboot the machine to activate the new configuration.
sudo reboot