var img = document.createElement('img'); img.src = "https://easystat.de/piwik.php?idsite=13&rec=1&url=https://docs.vps2day.com" + location.pathname; img.style = "border:0"; img.alt = "tracker"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(img,s);
Skip to main content

How to configure IPv6 on Ubuntu

At VPS2day, usually you don't need to configure your network interfaces in any special way. When you deploy a new server, we automatically configure your server, so it works right out of the box.

However, it might be necessary to configure your network interfaces manually in some cases. To use your IPv6 address on your Ubuntu 22.04 LTS or 20.04 LTS server, you can follow the steps below.

note

This tutorial requires you to know how to edit a file. If you're unfamiliar with this, please read our tutorial on how to edit a file in Linux, first.

Statically configure your IPv6 address

  1. Open the /etc/netplan/01-netcfg.yaml file in a text editor.
  2. Add the following lines to the file, replacing the placeholder values with your own settings:
    /etc/netplan/01-netcfg.yaml
    network:
    version: 2
    renderer: networkd
    ethernets:
    eth0:
    dhcp4: true
    dhcp6: false
    addresses:
    - <IPV6_ADDRESS>/<IPV6_NETMASK>
    gateway6: <IPV6_GATEWAY>
  3. Save the file and exit your editor.
  4. Apply the changes by running the following command:
sudo netplan apply

The placeholders need to be replaced with the following settings:

  • <IPV6_ADDRESS> - This is the IPv6 address of your server. You can find it in the Network tab of our client portal (1).
  • <IPV6_NETMASK> - This is the netmask of your IPv6 address. Usually it's 64. You can also find it in the Network tab right next to the IPv6 address of your server (2).
  • <IPV6_GATEWAY> - This is the IPv6 gateway of your server. You can find it in the Network tab right next to the column with the IPv6 address information (3).

IPv6 address information

warning

If you are configuring the settings via SSH, it’s normal that the session may be frozen for a few seconds. Please double-check all settings before applying your changes. If you mis-configure your network settings, you may have to use a VNC console to fix the settings because your server might lose its network connectivity. You can learn more about the VPS2day VNC console here.

Automatically configure your IPv6 address

While it's totally possible to statically configure your IPv6 address, we recommend using the so-called SLAAC (Stateless Address Autoconfiguration). By utilizing this feature of IPv6, you don't need to manually configure anything. Your server will automatically obtain its IPv6 address and the gateway(s) it needs to use.

To use SLAAC, you need to make sure that the following lines are present in your /etc/netplan/01-netcfg.yaml file:

/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true
dhcp6: true