How do I configure the IPv6 address on my VPS?

VPS 2 min read

IPv6 is the successor to IPv4: with its 128-bit addresses, it provides a virtually inexhaustible address space. In our KVM VPS plans, every server is assigned an IPv6 address in addition to its IPv4 address.

Why should you use it?

  • An increasing number of internet service providers and mobile networks are using IPv6, meaning that some visitors can access the server directly, without the need for address translation.
  • Certain services (such as email communication with major service providers) also communicate via IPv6; if the server is also accessible via IPv6, this must be configured correctly.
  • The IPv6 address is assigned to the server, so you won’t need to worry about address shortages in the future.

First, check

IPv6 may already be up and running. Take a look:

ip -6 addr show
ip -6 route show

If a scope global IPv6 address is visible on the interface and there is a default via route, then it is configured; proceed to the check.

Settings

You can find the IPv6 address, prefix length and gateway in the client portal, under the VPS service details. In the examples below, replace the address 2001:db8:1234::10/64 and the gateway 2001:db8:1234::1 with your own, whilst the interface name (eth0, ens3) is displayed by the ip link command.

Ubuntu (netplan): edit the file in the /etc/netplan/ directory:

network:
  version: 2
  ethernets:
    ens3:
      addresses:
        - 2001:db8:1234::10/64
      routes:
        - to: "::/0"
          via: "2001:db8:1234::1"

If the file already contains IPv4 settings, simply add the IPv6 lines to the existing list of addresses and routes. Test it using the command sudo netplan try: if the connection is lost, the previous settings will be restored after 120 seconds. If everything is OK, apply the changes permanently: sudo netplan apply.

Debian (ifupdown): in the /etc/network/interfaces file:

iface eth0 inet6 static
    address 2001:db8:1234::10/64
    gateway 2001:db8:1234::1

Then: sudo systemctl restart networking.

AlmaLinux, Rocky Linux (NetworkManager):

nmcli connection show
sudo nmcli connection modify "eth0" ipv6.method manual ipv6.addresses 2001:db8:1234::10/64 ipv6.gateway 2001:db8:1234::1
sudo nmcli connection up "eth0"

The name of the connection is listed in the first command.

Verification

ping -6 -c 4 google.com
curl -6 https://ifconfig.co

If you receive a ping response and the second command displays your IPv6 address, the connection is working. For network troubleshooting, the article demonstrating the use of ping, traceroute, mtr, dig and curl provides further tools.

Don’t forget

  • Firewall: the rules must also apply to IPv6 traffic, otherwise the server may remain unprotected on IPv6; see the article on configuring the VPS firewall.
  • DNS: if you want your website to be accessible via IPv6, add an AAAA record to your domain with the server’s IPv6 address.
  • Web server: check that Nginx or Apache is also listening on the IPv6 address (for Nginx, for example, listen [::]:443 ssl;).
Back: VPS articles (12)