Operations 6 min read

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 procedure for configuring a static IPv6 address on Ubuntu using command‑line tools, Netplan or legacy interfaces, and verification commands.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Configure a Static IPv6 Address on Ubuntu: Step‑by‑Step Guide

What is IPv6 and Why It Matters

IPv6 (Internet Protocol version 6) is the latest IP standard, offering a 128‑bit address space that vastly expands the number of available addresses, simplifies header structures, improves built‑in security with IPsec, eliminates the need for NAT, and supports automatic configuration via SLAAC.

Tools for Configuring IPv6 on Ubuntu

Ubuntu typically enables IPv6 by default. You can manage it with commands such as ifconfig or ip a, edit configuration files like /etc/netplan/01-netcfg.yaml (for newer releases) or /etc/network/interfaces (for older releases), or use GUI network settings.

Step‑by‑Step Process to Set a Static IPv6 Address

1. Verify IPv6 Support

Open a terminal and run one of the following to confirm that an IPv6 address is present:

ifconfig
ip a

2. Edit the Network Configuration File

For Ubuntu 18.04+ (Netplan), edit the YAML file, e.g.: sudo nano /etc/netplan/01-netcfg.yaml For older versions, edit /etc/network/interfaces instead.

3. Add the Static IPv6 Configuration

Example Netplan snippet (replace interface name, address, and gateway with your values):

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::8844

Legacy /etc/network/interfaces example:

iface eth0 inet6 static
address 2001:db8::c0ca:1eaf
netmask 64
gateway 2001:db8::1

4. Apply the Changes

For Netplan: sudo netplan apply For the older interface method: sudo ifdown eth0 && sudo ifup eth0 Replace eth0 with your actual interface name.

5. Verify the Configuration

Run the following to display the IPv6 address assigned to the interface: ip -6 addr show You should see the new IPv6 address listed under the appropriate network interface.

Additional Notes

Replace eth0 and enp0s3 with the actual names of your network interfaces.

The example address 2001:db8::c0ca:1eaf/64 and gateway 2001:db8::1 are placeholders; use the values provided by your network administrator or ISP.

Ensure the network prefix (e.g., /64) matches your network’s configuration.

If you prefer a graphical approach, you can configure IPv6 via the system settings panel’s network section.

IPv6Network ConfigurationUbuntuStatic IPNetplan
Liangxu Linux
Written by

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.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.