IPv6 adoption continues to grow, and many VPS providers now offer IPv6 addresses alongside IPv4. This guide covers configuring IPv6 correctly on your server for dual-stack operation.
Why IPv6 Matters
- IPv4 address exhaustion makes IPv6 increasingly important for future-proofing
- Some networks/ISPs are IPv6-preferred or IPv6-only, and having both ensures maximum reachability
- Often provided free alongside IPv4 by hosting providers, with no reason not to enable it
Step 1 — Check Whether Your VPS Has an IPv6 Address Assigned
ip -6 addr show
If nothing appears, check your hosting provider's control panel — IPv6 may need to be explicitly enabled/assigned for your instance.
Step 2 — Configure the IPv6 Address (If Not Automatic)
sudo nano /etc/netplan/50-cloud-init.yaml
network:
ethernets:
eth0:
addresses:
- 2001:db8::2/64
gateway6: 2001:db8::1
nameservers:
addresses: [2606:4700:4700::1111]
Use the exact IPv6 address, prefix, and gateway values provided by your hosting provider.
sudo netplan apply
Step 3 — Verify Connectivity
ping6 google.com
Step 4 — Add an AAAA DNS Record
In your domain's DNS settings, add an AAAA record pointing to your VPS's IPv6 address, alongside the existing A record for IPv4 — see How to Point a Domain to Your VPS (A/AAAA Records).
Step 5 — Configure Nginx/Apache to Listen on IPv6
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
server_name yourdomain.com;
}
The [::]: syntax specifies the IPv6 wildcard address — without this, your web server only accepts IPv4 connections even if the DNS AAAA record exists.
Step 6 — Configure the Firewall for IPv6
UFW automatically applies most rules to both IPv4 and IPv6 if IPV6=yes is set in /etc/default/ufw (the default in most modern distributions) — verify this:
sudo cat /etc/default/ufw | grep IPV6
Testing IPv6 Access to Your Website
curl -6 https://yourdomain.com
Or use an online IPv6 connectivity checker to confirm your site is reachable over IPv6 from the public internet.
Common Errors
Site unreachable over IPv6 despite AAAA record — verify the web server is explicitly listening on [::], not just the IPv4 wildcard.
IPv6 configured but no connectivity — verify the gateway address and prefix length exactly match what your provider specified; a small typo in IPv6 addressing is a very common cause of connectivity failure.
Best Practices
- Enable IPv6 if your provider offers it at no additional cost — there's little downside
- Ensure firewall rules apply consistently to both IPv4 and IPv6
- Test connectivity explicitly over IPv6, don't assume dual-stack works just because IPv4 does
Continue Reading
- How to Point a Domain to Your VPS (A/AAAA Records)
- How to Configure UFW (Uncomplicated Firewall) on Ubuntu & Debian
- DNS Records Explained: A, AAAA, CNAME, MX, TXT & More
Browse more articles in Advanced Networking & VPN.
