How to Add a Public IPv6 Address to a Dedicated Server (Ubuntu and Debian)

This guide will walk you through the precise steps needed to successfully bind an IPv6 address to your dedicated machine.

Dedicated Servers vs Peer To Peer - CTCservers

Understanding and Preparing for IPv6

Ubuntu and Debian

What is IPv6 and Why Do You Need It?

Internet Protocol version 6 (IPv6) is the most recent version of the communications protocol that provides an identification and location system for computers on networks. Designed to replace the exhausted IPv4 system, IPv6 utilizes a 128-bit addressing format rather than a 32-bit one. This fundamental change allows for an astronomically larger pool of unique IP addresses, which is absolutely essential to support the exponential growth of internet-connected devices worldwide.

Beyond simply offering a nearly infinite supply of addresses, IPv6 introduces several significant technical enhancements over its predecessor. It provides much more efficient packet routing, eliminates the need for Network Address Translation (NAT) which often complicates direct peer-to-peer communication, and improves packet processing capabilities. For server administrators, this means lower latency and a more streamlined network architecture.

When operating a dedicated server, configuring a public IPv6 address guarantees that your infrastructure can communicate natively with modern networks. Many mobile carriers and large ISPs are rapidly transitioning to IPv6-only infrastructures. Ensuring dual-stack availability meaning your server supports both IPv4 and IPv6 simultaneously is a critical best practice to maximize your server's accessibility, reach, and long-term reliability.

Prerequisites

  • Administrative Access: Root access or a user account with sudo privileges on the server.
  • Operating System: A dedicated server running either Ubuntu or Debian.
  • Command Line Familiarity: Basic knowledge of navigating the terminal and using text editors like nano or vim.
  • Network Details: Your specific IPv6 assignment details provided by your hosting provider (address, prefix/netmask, and gateway).
Adding a public IPv6 address to your dedicated server requires updating your network configuration files. Since Ubuntu and Debian handle networking differently by default (Ubuntu uses Netplan, while Debian uses ifupdown), the steps will vary depending on your OS.
Before you begin, make sure you have the following information from your dedicated server hosting provider:
  • Your assigned IPv6 Address (e.g., 2001:db8:1234::10)
  • The Subnet Prefix / CIDR (usually /64 or /48)
  • Your IPv6 Gateway (e.g., 2001:db8:1234::1)
  • Your Network Interface Name (find this by running ip a. It is usually eth0 , ens3 , eno1 etc.)
Here are the step-by-step instructions for both operating systems.

Option A: Ubuntu (Using Netplan)

Modern Ubuntu releases (20.04, 22.04, 24.04) use Netplan for network configuration.
1

Locate your Netplan configuration file

Netplan files are stored in /etc/netplan/. List the contents of the directory to find your config file (usually named something like 01-netcfg.yaml , 50-cloud-init.yaml , or 00-installer-config.yaml):
BASH
ls /etc/netplan/
2

Edit the configuration file

Open the file using your preferred text editor (like nano):
BASH
sudo nano /etc/netplan/01-netcfg.yaml
3

Add the IPv6 details

Carefully add your IPv6 address and routing information. Note: YAML relies strictly on indentation (spaces, not tabs).
Note: In newer versions of Netplan, gateway6 is deprecated in favor of the routes block.
BASH
network:
  version: 2
  ethernets:
    eth0:  # Replace with your actual interface name
      dhcp4: true  # Keep your existing IPv4 config intact
      addresses:
        - "2001:db8:1234::10/64" # Add your IPv6 address and prefix here
      routes:
        - to: default
          via: "2001:db8:1234::1" # Add your IPv6 gateway here
      nameservers:
        addresses:
          - 2001:4860:4860::8888 # Google's IPv6 DNS (Optional)
          - 2001:4860:4860::8844
4

Test and apply the configuration

First, test the configuration to ensure there are no syntax errors:
BASH
sudo netplan try
If the test is successful and you don't lose connection, press ENTER to accept it. Alternatively, you can apply it directly:
BASH
sudo netplan apply

Option B: Debian (Using /etc/network/interfaces)

Standard Debian installations (11 Bullseye, 12 Bookworm) use the traditional ifupdown method.
1

Edit the interfaces file

Open your network configuration file using a text editor:
BASH
sudo nano /etc/network/interfaces
2

Add the IPv6 configuration block

Scroll down to where your primary network interface (e.g., eth0 or ens3) is defined for IPv4. Below that block, add the new inet6 static block for your IPv6 configuration:
Plaintext
# Existing IPv4 configuration might look like this:
auto eth0
iface eth0 inet dhcp

# Add your new IPv6 configuration below:
iface eth0 inet6 static
    address 2001:db8:1234::10    # Your IPv6 Address
    netmask 64                   # Your Subnet Prefix (e.g., 64)
    gateway 2001:db8:1234::1     # Your IPv6 Gateway
    dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844
3

Restart the networking service

Apply the changes by restarting the networking service. (Warning: If you made a typo, this could disconnect your SSH session. Double-check your IP details first.)
Bash
sudo systemctl restart networking
Alternatively, you can bounce the interface specifically:
Bash
sudo ifdown eth0 && sudo ifup eth0
5

Verify the Configuration (Both OS)

Once you've applied the changes on either Ubuntu or Debian, verify that the address is active and routing properly.
1. Check if the IP is assigned to the interface:
Bash
ip -6 a show eth0
You should see your new IPv6 address listed with a scope global tag.
2. Test outbound connectivity:
Ping an external IPv6 address (like Google's DNS) to ensure routing is working:
Bash
ping6 google.com
# or
ping -6 2001:4860:4860::8888
If you receive replies, your IPv6 is successfully configured and active.

Discover CTCservers Dedicated Server Locations

CTCservers servers are available around the world, providing diverse options for hosting websites. Each region offers unique advantages, making it easier to choose a location that best suits your specific hosting needs.

Limited Time
Special Offers
Server upgrades & more.
UK Region London
15%
OFF
Asia Pacific Tokyo
10%
OFF