Check What You Have
ip -6 a
ip -6 r
Your provider's control panel shows the IPv6 address or block assigned to the server, its prefix length, often /64, and the gateway. Use those values, never invented ones. The examples here use the documentation range 2001:db8::/32 and the interface eth0; find yours with ip -br link. If the server already shows a global address and a default route, IPv6 may be configured automatically, and you only need the testing and firewall steps.
Link-Local and Global Addresses
- Link-local: starts with
fe80::, showsscope link, and exists on every IPv6 interface. It works only on the local network segment and cannot reach the internet. - Global: shows
scope globaland is the public address, such as2001:db8:10::2/64.
A link-local address alone means IPv6 is enabled but not configured.
Before You Change Anything
A wrong network setting cuts your SSH session. Know where the server console is in your provider's control panel, save the output of ip a and ip r, and apply changes with a safe method: netplan try, or a timed rollback with NetworkManager. Changes made with ip last only until reboot and are the safe way to test first:
sudo ip -6 addr add 2001:db8:10::2/64 dev eth0
sudo ip -6 route add default via fe80::1 dev eth0
Many providers use a link-local gateway such as fe80::1. A link-local address is only valid together with an interface, so the route must name it with dev.
Static IPv6 with Netplan
network:
version: 2
ethernets:
eth0:
addresses:
- 203.0.113.10/24
- "2001:db8:10::2/64"
routes:
- to: default
via: 203.0.113.1
- to: default
via: "fe80::1"
Add the IPv6 address to the existing list and a second default route; the interface is implied in netplan. Quoting IPv6 values avoids YAML surprises. Apply with sudo netplan try; the full procedure, including the cloud-init file, is in how to configure a static IP with netplan.
Static IPv6 with NetworkManager
sudo nmcli connection modify "System eth0" \
ipv6.method manual \
ipv6.addresses 2001:db8:10::2/64 \
ipv6.gateway fe80::1
sudo nmcli connection up "System eth0"
Use your connection name from nmcli connection show, and set up a rollback first, as described in how to set a static IP with nmcli.
Test the Connection
ip -6 r
ping -6 -c 4 fe80::1%eth0
ping -6 -c 4 example.com
curl -6 -I https://example.com
The route list should contain a default via line. A link-local gateway is pinged with the interface name after a percent sign. If ping to the gateway works but not beyond, the gateway or prefix is wrong. If curl -6 works, outgoing IPv6 is fine. Test incoming traffic from another IPv6-capable machine.
Firewall Rules for IPv6
- ufw: with
IPV6=yesin/etc/default/ufw, the default, a rule that names no IPv4 address applies to IPv6 too, andufw statuslists that copy with(v6). - firewalld: zones and services apply to both protocols; rich rules with a source address are written per family.
- nftables: a table of family
inetcovers both. - iptables: rules cover IPv4 only; IPv6 needs separate
ip6tablesrules.
Allow ICMPv6. IPv6 depends on it to find neighbors and the path MTU.
DNS and Services
Run sudo ss -tlnp: a service listening on [::] accepts IPv6 connections. Nginx needs its own lines, such as listen [::]:80; and listen [::]:443 ssl;. Add the AAAA record only after everything works, as explained in DNS record types explained; a broken AAAA record makes the site slow for IPv6 visitors.
Do Not Turn IPv6 Off as a Fix
Disabling IPv6 hides a configuration problem and can break software that expects the loopback ::1. If IPv6 does not work yet, remove the AAAA record, fix the address, route, or firewall, then publish it again.