Configuring IPv6 on your server

Every server has an IPv6 block routed to it. Turning it on takes a few lines of network configuration and a careful test.

Where do I find my IPv6 details?

On the server page of the console, next to the IPv4 address: the block assigned to your machine and the gateway to use. You choose which addresses inside the block to configure. The examples below use the documentation prefix 2001:db8:4a00:1c::/64 with gateway 2001:db8:4a00:1cff:ff:ff:ff:ff; replace both with your own values.

How do I configure it on Debian with ifupdown?

Add an inet6 static stanza for the same interface that already carries IPv4 in /etc/network/interfaces. The gateway sits outside the /64 in this addressing scheme, so a route marked on-link must be added before the default route.

iface eno1 inet6 static
    address 2001:db8:4a00:1c::10/64
    post-up ip -6 route add 2001:db8:4a00:1cff:ff:ff:ff:ff dev eno1
    post-up ip -6 route add default via 2001:db8:4a00:1cff:ff:ff:ff:ff dev eno1
    pre-down ip -6 route del default via 2001:db8:4a00:1cff:ff:ff:ff:ff dev eno1

Apply it without a reboot with ifdown eno1 && ifup eno1 only from a session that does not depend on that interface; safer is a scheduled restart of networking with an undo armed, or simply a reboot from the console after checking the syntax.

And with netplan on Ubuntu?

Add the address and a route with on-link: true to the existing file in /etc/netplan/. Use netplan try, which reverts by itself if you lose the connection and do not confirm.

      addresses:
        - 2001:db8:4a00:1c::10/64
      routes:
        - to: default
          via: 2001:db8:4a00:1cff:ff:ff:ff:ff
          on-link: true

And on AlmaLinux, Rocky Linux or Fedora?

NetworkManager handles it through nmcli. Find the connection name first, then set the address, gateway and manual method and reapply.

nmcli -g NAME,DEVICE connection show --active
nmcli connection modify "System eno1" ipv6.method manual ipv6.addresses 2001:db8:4a00:1c::10/64 ipv6.gateway 2001:db8:4a00:1cff:ff:ff:ff:ff
nmcli connection up "System eno1"

NetworkManager adds the on-link route to the gateway by itself in current releases. If the default route does not appear, add ipv6.routes "2001:db8:4a00:1cff:ff:ff:ff:ff/128" to the same connection.

How do I test that it works?

Check the address, the route and a real connection to an outside host, then repeat from another machine towards yours.

ip -6 -br addr show dev eno1
ip -6 route show default
ping -6 -c 3 2620:fe::fe
curl -6 -sS https://ifconfig.co

If outbound pings fail, the usual suspects are a typo in the gateway, a missing on-link route, or a firewall that drops ICMPv6. If outbound works but nobody reaches you, check the inbound firewall rules for IPv6, which are separate from IPv4 rules with iptables.

Can I use more than one address from the block?

Yes, as many as you like. Extra addresses let you run several TLS sites or services each on its own address, separate traffic in logs, or hand addresses to containers and virtual machines. Add them as further lines under addresses in netplan, extra up ip -6 addr add lines in ifupdown, or with nmcli connection modify +ipv6.addresses.

ip -6 addr add 2001:db8:4a00:1c::25/64 dev eno1   # temporary, lost on reboot

How do I serve web traffic on both protocols?

Make every public service listen on IPv6, open it in the firewall and publish an AAAA record. Nginx needs an explicit listen [::]:443 ssl; next to the IPv4 line; Apache's Listen 443 covers both by default. SSH listens on both unless AddressFamily inet is set.

ItemCheck
Listening socketsss -6 -ltn shows your ports on [::] or your address
Firewallip6tables -S or the inet nftables table allows the same ports as IPv4
DNSdig AAAA example.com returns the address you configured
CertificatesIssued for the name, so they work on both protocols unchanged

Are there pitfalls with IPv6 on a server?

Three come up often. Services bound to 0.0.0.0 listen on IPv4 only, so check configuration files that name an address. Allow-lists written for IPv4 need IPv6 entries too, or partners on IPv6 get blocked. And the IPv4 reverse DNS set in the console does not cover IPv6 addresses, so mail servers should deliver over IPv4, as Send email from your server explains. For background on how addresses are assigned, read IPv6 and reverse DNS on your server.

Related pages

IPv6 and reverse DNS on your server

Configuring the IPv6 block that comes with every machine and setting the reverse DNS name of its IPv4 address from the console.

Read more

Build an iptables firewall

A default-deny host firewall with iptables or nftables: allow SSH and web, rate-limit new connections, cover IPv6 and keep the rules across reboots.

Read more

Send email from your server

Let applications send mail reliably: a local Postfix that only sends, queue checks, port 25 versus submission and using an outside relay.

Read more

Ubuntu Server

The default pick for most rentals: 24.04 or 22.04 LTS, recent kernels for new EPYC and Ryzen chips, five years of updates.

Read more

Questions and answers

Is IPv6 included with every server?

Yes. Every machine in every location has an IPv6 block routed to it, shown in the console next to the IPv4 address.

Why does my IPv6 gateway need an on-link route?

The gateway address sits outside the configured prefix, so the system must be told it is reachable directly on the interface before using it as default route.

Can I configure several IPv6 addresses?

Yes. Add as many addresses from the block as you need, for sites, containers or virtual machines.

Do iptables rules cover IPv6?

No. iptables handles IPv4 only; use ip6tables for IPv6, or an nftables table of type inet for both.

Can I set reverse DNS for IPv6 addresses?

The console sets reverse DNS for the IPv4 address. Use IPv4 for outgoing mail, where reverse DNS matters most.