Configuring a static IPv6 address on Ubuntu 22.04 LTS is essential for server administrators who need consistent connectivity and predictable server availability. Static addressing ensures a fixed IPv6 address, vital for services requiring stable endpoints. Ubuntu 22.04 LTS uses Netplan, a modern tool replacing ifupdown, for network configuration. This guide offers step-by-step instructions to prepare your server and set up a static IPv6 address with Netplan.
Prerequisites for Static IPv6 Address Configuration
Before setting a static IPv6 address on Ubuntu 22.04 LTS, first ensure your network supports IPv6. Check that routers and switches are configured for IPv6 traffic, and confirm with your ISP or network team that you have a valid IPv6 prefix and address range for your server.
To modify network configuration files, you need root or sudo privileges; without them, changes can’t be applied. It’s also strongly recommended to have physical or remote console access, like IPMI or a KVM switch, before making changes. This way, you can restore connectivity if a misconfiguration occurs and avoid being locked out.
Identify the network interface to configure with a static IPv6 address. Use commands like ip a
or ls /sys/class/net/
to list available interfaces. Typical names in Ubuntu 22.04 include ens33
, eth0
, or enp0s3
, depending on your system.
Gather the necessary network details: the desired static IPv6 address, prefix length (usually /64
), the default gateway’s IPv6 address, and (optionally) preferred DNS server addresses. Having this information prepared helps ensure a smooth and error-free configuration.
Editing Netplan Files to Assign a Static IPv6 Address
Ubuntu 22.04 LTS manages network settings with Netplan, using configuration files usually found in /etc/netplan/
. First, locate the appropriate YAML file—often called 00-installer-config.yaml
or similar. Always back up the original file before making changes to ensure you can easily restore it if needed.
Open the Netplan configuration file with a text editor like nano
or vim
. Find the target network interface section, set dhcp6
to no
to disable IPv6 autoconfiguration, then add your static IPv6 address and prefix under addresses
(e.g., [2001:db8::1001/64]
) and set gateway6
with your default IPv6 gateway.
To enable DNS resolution over IPv6, add a nameservers
section to the interface and include IPv6 DNS addresses under the addresses
array. Ensure proper indentation in your final YAML configuration, as Netplan requires it.
network:
version: 2
ethernets:
ens33:
dhcp6: no
addresses:
- 2001:db8::1001/64
gateway6: 2001:db8::1
nameservers:
addresses:
- 2001:4860:4860::8888
- 2001:4860:4860::8844
After saving your Netplan file, validate it with sudo netplan try
(for safe testing) or sudo netplan apply
. Then, check the static IPv6 address with ip -6 addr show
and test connectivity using ping6 google.com
. If both checks succeed, your Ubuntu 22.04 LTS server is using a static IPv6 address.
Configuring a static IPv6 address on Ubuntu 22.04 LTS with Netplan is essential for server reliability and accessibility. By meeting prerequisites and accurately editing Netplan YAML files, administrators ensure servers have persistent IPv6 addresses, supporting advanced network management and reliable service. Proper documentation and verification improve stability and help prevent misconfiguration.