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

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 18.04 or Debian 9.
  • 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 requires different steps depending on your operating system, because Ubuntu 18.04 and Debian 9 use completely different network managers by default. Ubuntu 18.04 uses Netplan, while Debian 9 uses the traditional ifupdown (/etc/network/interfaces).
Before you begin, make sure you have the following information from your dedicated server hosting provider:
  • Your assigned IPv6 Address (e.g., 2001:db8::100)
  • Your IPv6 Prefix/Netmask (usually /64)
  • Your IPv6 Gateway (e.g., 2001:db8::1)
  • The name of your public network interface (usually eth0 , ens3 , or eno1. You can find this by running ip a).
Here are the step-by-step instructions for both operating systems.

Option A: Ubuntu 18.04 (Using Netplan)

Ubuntu 18.04 uses YAML configuration files for networking. Note: YAML is strictly indentation-sensitive. Use spaces, not tabs, for indentation.
1

Locate your Netplan configuration file

Find the name of your configuration file by listing the contents of the netplan directory:
BASH
ls /etc/netplan/
You will likely see a file named 50-cloud-init.yaml , 01-netcfg.yaml , or 00-installer-config.yaml .
2

Backup the configuration file

It's always safe to have a backup in case you lock yourself out.
BASH
sudo cp /etc/netplan/YOUR_FILE.yaml /etc/netplan/YOUR_FILE.yaml.backup
3

Edit the configuration file

Open the file in a text editor like nano:
BASH
sudo nano /etc/netplan/YOUR_FILE.yaml
4

Add the IPv6 configuration

Locate your primary interface (e.g., eth0 or ens3). Add your IPv6 address to the addresses array, and add gateway6.
Your file should look something like this (add the lines containing your IPv6 details):
BASH
network:
  version: 2
  ethernets:
    eth0:
      dhcp4: no
      dhcp6: no
      addresses:
        - 192.0.2.10/24               # Your existing IPv4
        - 2001:db8::100/64            # Add your IPv6 and prefix here
      gateway4: 192.0.2.1           # Your existing IPv4 gateway
      gateway6: 2001:db8::1           # Add your IPv6 gateway here
      nameservers:
        addresses:
          - 8.8.8.8
          - 2001:4860:4860::8888      # Optional: Google's IPv6 DNS
5

Apply the changes

Save the file (Ctrl+O , Enter , Ctrl+X in nano) and apply the configuration:
Bash
sudo netplan apply

Option B: Debian 9 (Using ifupdown)

Debian 9 uses the traditional network interfaces file.
1

Backup your interfaces file

BASH
sudo cp /etc/network/interfaces /etc/network/interfaces.backup
2

Edit the interfaces file

Open the file in a text editor:
Bash
sudo nano /etc/network/interfaces
3

Add the IPv6 configuration block

Scroll to the bottom of the file (or right below your IPv4 configuration for your primary interface, e.g., eth0) and add the following block. Replace the interface name and IP details with your own:
Plaintext
# Existing IPv4 config above...

# IPv6 Configuration
iface eth0 inet6 static
    address 2001:db8::100
    netmask 64
    gateway 2001:db8::1
    autoconf 0
    accept_ra 0
(Note: Replace eth0 with your actual interface name).
4

Restart the networking service

Save the file (Ctrl+O , Enter , Ctrl+X in nano) and restart the networking service to apply the new IP:
Bash
sudo systemctl restart networking
Alternatively, you can restart the specific interface using sudo ifdown eth0 && sudo ifup eth0 (Be cautious doing this over SSH, as a typo might drop your connection).
5

Verify Your IPv6 Connectivity (Both OS)

Once you have applied the changes on either operating system, you should verify that the IPv6 address is active and can reach the outside world.
1. Check if the IP is assigned to the interface:
Bash
ip -6 a
You should see your public IPv6 address listed under your network interface.
2. Test outbound connectivity:
Ping a public IPv6 address (like Google's DNS) to ensure your gateway is routing traffic correctly:
Bash
ping6 -c 4 2001:4860:4860::8888
or
Bash
ping6 -c 4 google.com
If you get a response, your dedicated server is successfully configured with its new public IPv6 address.

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