IPv6 configuration on Linux has evolved significantly with the introduction of modern network management tools. This guide covers the essential methods for configuring IPv6 across different Linux distributions, from checking your current status to setting up static addresses and DHCPv6 clients.
Before configuring IPv6, verify whether it's currently enabled and what addresses are assigned.
The modern ip command from the iproute2 package is the standard tool for network configuration:
# Display all IPv6 addresses
ip -6 addr show
# Show only global scope IPv6 addresses (excluding [link-local](link-local-addresses-function))
ip -6 addr show scope global
# Display IPv6 routing table
ip -6 route show
While deprecated, ifconfig still exists on some systems:
# Show all interfaces with IPv6 addresses (look for inet6)
ifconfig -a
Note: ifconfig is obsolete and not installed by default on modern Linux distributions.
Check if IPv6 is enabled at the kernel level:
# Method 1: Check sysctl parameter (0=enabled, 1=disabled)
sysctl net.ipv6.conf.all.disable_ipv6
# Method 2: Check sys filesystem
cat /sys/module/ipv6/parameters/disable
# Method 3: Verify IPv6 proc entry exists
ls /proc/net/if_inet6
Linux distributions use different network management systems. Choose the method that matches your distribution.
NetworkManager is the default on most desktop Linux systems and provides both GUI and CLI configuration.
Configure IPv6 using NetworkManager's command-line interface:
# Add static IPv6 address
nmcli con mod eth0 ipv6.addresses "2001:db8::10/64"
nmcli con mod eth0 ipv6.gateway "2001:db8::1"
nmcli con mod eth0 ipv6.method manual
# Enable [DHCPv6](configure-dhcpv6)
nmcli con mod eth0 ipv6.method dhcp
# Enable [SLAAC](slaac-explained) (Stateless Address Autoconfiguration)
nmcli con mod eth0 ipv6.method auto
# Configure privacy extensions (RFC 4941)
nmcli con mod eth0 ipv6.ip6-privacy 2
# Configure stable privacy addressing with custom token
nmcli con mod eth0 ipv6.addr-gen-mode eui64
nmcli con mod eth0 ipv6.token "::deca:fbad:c0:ffee"
# Apply changes
nmcli con up eth0
nmcli con mod eth0 ipv6.method ignore
nmcli con up eth0
Netplan is Ubuntu's declarative network configuration tool that uses YAML syntax and can control both NetworkManager and systemd-networkd backends.
Netplan configuration files are located in /etc/netplan/ with .yaml extension.
Edit /etc/netplan/01-netcfg.yaml:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true
dhcp6: false
addresses:
- 2001:db8:1::10/64
gateway6: 2001:db8:1::1
nameservers:
addresses:
- 2001:4860:4860::8888
- 2001:4860:4860::8844
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true
dhcp6: true
accept-ra: true
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true
dhcp6: false
accept-ra: true
ipv6-privacy: true
# Test configuration syntax
netplan generate
# Apply configuration
netplan apply
# Debug configuration
netplan --debug apply
systemd-networkd is the native network manager of systemd, lightweight and suitable for servers.
Create or edit files in /etc/systemd/network/ with .network extension.
Create /etc/systemd/network/20-wired.network:
[Match]
Name=eth0
[Network]
Address=2001:db8:1::10/64
Gateway=2001:db8:1::1
DNS=2001:4860:4860::8888
DNS=2001:4860:4860::8844
[Match]
Name=eth0
[Network]
DHCP=yes
[DHCPv6]
UseAddress=yes
UseDNS=yes
[Match]
Name=eth0
[Network]
IPv6AcceptRA=yes
[IPv6AcceptRA]
DHCPv6Client=no
[Match]
Name=eth0
[Network]
IPv6AcceptRA=yes
DHCP=ipv6
[IPv6AcceptRA]
DHCPv6Client=yes
[DHCPv6]
UseAddress=no
UseDNS=yes
[Match]
Name=eth0
[Network]
IPv6AcceptRA=yes
IPv6PrivacyExtensions=yes
# Enable and start systemd-networkd
systemctl enable systemd-networkd
systemctl start systemd-networkd
# Restart after configuration changes
systemctl restart systemd-networkd
# Check status
systemctl status systemd-networkd
networkctl status
Older Debian-based systems use the /etc/network/interfaces file.
Edit /etc/network/interfaces:
# Static IPv6
auto eth0
iface eth0 inet6 static
address 2001:db8:1::10
netmask 64
gateway 2001:db8:1::1
dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844
# Enable SLAAC
auto eth0
iface eth0 inet6 auto
# Restart networking service
systemctl restart networking
# Or use ifup/ifdown
ifdown eth0 && ifup eth0
Configure IPv6 behavior at the kernel level by editing /etc/sysctl.conf or creating files in /etc/sysctl.d/.
# Enable IPv6 globally
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
# Disable IPv6 globally
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
# Accept RA (required for SLAAC)
net.ipv6.conf.all.accept_ra = 1
net.ipv6.conf.default.accept_ra = 1
# Accept RA even when forwarding is enabled (for routers)
net.ipv6.conf.all.accept_ra = 2
# Enable privacy extensions
net.ipv6.conf.all.use_tempaddr = 2
net.ipv6.conf.default.use_tempaddr = 2
Values for use_tempaddr:
# Disable SLAAC
net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.default.accept_ra = 0
# Apply immediately
sysctl -p
# Or reload from /etc/sysctl.d/
sysctl --system
# Apply single parameter
sysctl -w net.ipv6.conf.all.forwarding=1
Most modern network managers include DHCPv6 client functionality. For standalone DHCPv6 clients:
# Request DHCPv6 lease
dhclient -6 eth0
# Release DHCPv6 lease
dhclient -6 -r eth0
# Configuration file: /etc/dhcp/dhclient6.conf
Some distributions use the Wide DHCPv6 client:
# Install
apt install wide-dhcpv6-client # Debian/Ubuntu
dnf install dhcpv6-client # Fedora/RHEL
# Configuration file: /etc/wide-dhcpv6/dhcp6c.conf
iproute2 (provides ip command)nmcliNetworkManager, iprouteiproute2, systemd/etc/sysconfig/network/After configuration, verify your IPv6 connectivity:
# Check assigned addresses
ip -6 addr show
# Verify routing
ip -6 route show
# Test loopback
ping6 ::1
# Test link-local (replace fe80::1 with actual gateway)
ping6 -c 4 fe80::1%eth0
# Test global connectivity
ping6 -c 4 2001:4860:4860::8888
Use online tools to verify your IPv6 configuration is working correctly:
# Command line tests
curl -6 https://ipv6.icanhazip.com
curl -6 https://api6.ipify.org
# DNS resolution
dig AAAA google.com
host -t AAAA google.com
Visit test-ipv6.run in your web browser for comprehensive IPv6 connectivity testing. This tool checks:
The testing runs entirely in your browser and provides detailed diagnostics for troubleshooting connectivity issues.
Check if IPv6 is disabled at kernel level:
sysctl net.ipv6.conf.all.disable_ipv6
Verify router advertisements (for SLAAC):
rdisc6 eth0
Check firewall rules:
ip6tables -L -n -v
Examine network manager logs:
journalctl -u NetworkManager
journalctl -u systemd-networkd
accept_ra is enabled for SLAACIPv6 configuration on Linux varies by distribution and network management tool, but the fundamental concepts remain consistent. Modern systems favor declarative configuration (Netplan, systemd-networkd) and automatic address assignment (SLAAC), while still supporting traditional static configuration when needed.
For most users, enabling DHCPv6 or SLAAC provides automatic configuration with minimal effort. System administrators requiring static addressing should choose the configuration method that matches their distribution's network manager.
Always verify your configuration with both local tools (ip, ping6) and external connectivity tests like test-ipv6.run to ensure proper dual-stack operation.