Exclusive Metin2 game shield on FreeBSD: Automatic siege mode, VIP list, and whitelist from your dashboard. See how it works
Create a server

Guide

How to Configure IPv6 on Your VPS

More and more users and mobile networks are connecting via IPv6. If your VPS only has IPv4, they can still access your website, but through their carrier’s gateways, which may introduce latency. In this guide, you’ll check whether your VPS already has IPv6, configure it if it’s missing, and verify that your firewall, website, and DNS are set up for the new address.

1. Check to see if you already have IPv6

Many providers assign an IPv6 address and configure it automatically. Before you do anything, check to see if this is the case:

ip -6 addr show scope globalip -6 route show defaultping -6 -c 3 2001:4860:4860::8888curl -6 https://ifconfig.co
  • If you see a global address, a default route, and the ping responds, it's working: proceed to step 3.
  • If there is no IP address, check your provider's control panel to see if they have assigned you an IPv6 address block and what its gateway is.
  • If the IP address is valid but the ping fails, it's usually because the default route is missing or the gateway is incorrect.

2. Configure it using netplan

In Ubuntu, the network is configured in /etc/netplan/. Find the name of your interface using ip link and make a copy of the file before editing it (in the example, it's called 50-cloud-init.yaml; use the name of your own):

ls /etc/netplan/sudo cp /etc/netplan/50-cloud-init.yaml /root/50-cloud-init.yaml.bak

Add the address and route within the existing interface without deleting the IPv4 settings. With your provider's address and gateway, it will look like this:

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

If the gateway is outside your block—which is common with some providers—add on-link: true below via. If the file is generated by cloud-init, check your provider's documentation for instructions on how to make the change permanent.

Apply the settings with netplan try: If you lose your connection and do not confirm within 120 seconds, the settings will automatically revert to the previous configuration:

sudo netplan try

Before pressing Enter, open a new second SSH session from your PC and verify that you can log in: just because the session you already have open is still active doesn't mean you can reconnect. Have your provider’s web console handy in case the automatic rollback doesn’t work. Only confirm once the second session has connected, and repeat the tests from step 1.

3. Check the firewall for IPv6

With IPv6, the VPS has a second public address, and the firewall must cover it. In UFW, make sure that /etc/default/ufw has IPV6=yes and that the rules you need also appear in its (v6) version. With IPV6=no, UFW won't allow IPv6 traffic through, and your services won't respond to the new address. If you’re using another iptables-based firewall, also check its ip6tables rules: what you block only on IPv4 may remain open on IPv6.

grep IPV6 /etc/default/ufwsudo ufw status verbose

If you had IPV6=no, change it to yes and apply it with sudo ufw reload, with your provider's console handy. Rules created before the change only exist for IPv4: re-add any that do not have the (v6) version and check again with sudo ufw status verbose. Also check which services are listening on all IPv6 addresses to see what will remain accessible via the new address:

sudo ss -tulpn | grep '\[::\]'

4. Configure your services to listen on IPv6

SSH listens on IPv6 by default. In Nginx, each server block needs its own listen [::] line alongside the IPv4 line (and the same applies to port 443 with ssl):

server {    listen 80;    listen [::]:80;    server_name example.com;    # ...}
sudo nginx -t && sudo systemctl reload nginx

5. Publish the address in the DNS

Create a record AAAA with the IPv6 address of the VPS, alongside the A record you already have. Once it propagates, test it end-to-end:

dig AAAA example.com +shortcurl -6 -I https://example.com

Do not publish the AAAA record until the website responds via IPv6: if AAAA is not working, visitors using IPv6 may experience delays in loading the website or may not be able to open it at all.

ext step

If you're setting up services that require full connectivity, choose a Cloud VPS and test the network from day one using the tests in Step 1.

Related guides