How to Configure a Static IPv6 Address on Ubuntu – Step‑by‑Step Guide
This guide explains why IPv6 is essential, outlines its key benefits, and provides a detailed, step‑by‑step process for checking support, editing Netplan or interfaces files, adding a static IPv6 address, applying changes, and verifying the configuration on Ubuntu systems.
What is IPv6
IPv6 (Internet Protocol version 6) is the current IP standard. It uses a 128‑bit address space, provides built‑in IPsec security, eliminates the need for NAT, and supports both stateful and stateless address autoconfiguration (SLAAC). These features increase address availability, simplify routing, and improve security and performance for modern networks.
Managing IPv6 on Ubuntu
Ubuntu enables IPv6 by default. You can inspect and control IPv6 with command‑line tools such as ifconfig or ip, and by editing the network configuration files: /etc/netplan/01‑netcfg.yaml (Ubuntu 18.04 and newer, Netplan) /etc/network/interfaces (older releases, ifupdown)
GUI network managers can also be used, but the following procedure shows the CLI method for a static IPv6 address.
Configuring a Static IPv6 Address
Verify IPv6 support
Open a terminal and list the interfaces. An IPv6 address indicates that the stack is active. ifconfig or
ip aEdit the network configuration file
For Netplan (Ubuntu 18.04 +), edit the YAML file that exists in /etc/netplan/ . For older systems, edit /etc/network/interfaces . sudo nano /etc/netplan/01-netcfg.yaml Replace the filename with the one present on your system.
Add the static IPv6 settings
Netplan example (replace interface name, address, prefix, gateway, and DNS with values supplied by your ISP or network admin):
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
dhcp6: no
addresses:
- 2001:db8::c0ca:1eaf/64
gateway6: 2001:db8::1
nameservers:
addresses:
- 2001:4860:4860::8888
- 2001:4860:4860::8844Legacy /etc/network/interfaces example :
iface eth0 inet6 static
address 2001:db8::c0ca:1eaf
netmask 64
gateway 2001:db8::1Apply the changes
After saving the file, reload the network configuration.
Netplan: sudo netplan apply Legacy ifupdown: sudo ifdown eth0 && sudo ifup eth0 Replace eth0 or enp0s3 with the actual interface name.
Verify the configuration
Show the IPv6 addresses assigned to each interface: ip -6 addr show The output should list the newly configured IPv6 address under the correct interface.
Additional Notes
Replace interface identifiers ( eth0, enp0s3) with the names shown by ip a or ifconfig.
The example address 2001:db8::c0ca:1eaf/64 and gateway 2001:db8::1 are placeholders; use the values provided by your ISP or network administrator.
Ensure the prefix length (e.g., /64) matches your network’s design.
For desktop environments, the same settings can be entered via the system settings → Network panel.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
