How to Configure IPv6 on a Linux Dedicated Server

The internet is continuously changing, and the depletion of IPv4 addresses is not far-fetched. IPv6 is not something of the future anymore but a requirement that needs to be considered now. Having a fundamental understanding of IPv6 is essential for future-proofing your infrastructure. It can play a crucial role in decision-making, especially when managing a dedicated Linux server, particularly one running the latest Ubuntu 24 release.
This guide has everything you need to know to configure IPv6 on a Linux dedicated server. At the end of this guide, you will have a working IPv6 solution to the point where you can accept the new era of the internet connection.
#Why IPv6 matters now more than ever
Before going over the technical details, let us understand the importance of IPv6:
- Address Exhaustion: IP addresses (IPv4) are running out, and most of the increasing devices and services are becoming dependent on IPv6.
- Scalability: IPv6 provides a number of addresses that are nearly astronomical, which means that it can connect every device on Earth.
- Efficiency: IPv6 has simplified the process of network configuration through stateless autoconfiguration (SLAAC) and also enhances the routing efficiency.
- Security: IPv6 has been thought out with security in mind, with IPsec being a mandatory component.
- Performance: In multiple cases, IPv6 is superior in performance; its packet headers are less complicated, and the routing paths are more straightforward.
To a dedicated server case, IPv6 will enable your server to connect directly with services and users that exclusively use IPv6, increasing its reach and making it compatible in the long term.
#Prerequisites
Before starting, ensure you have:
- A dedicated Linux server running (I am using Ubuntu 24.04)
- Root or sudo access to the server
- An IPv6 address block assigned by your hosting provider or network administrator
- Basic knowledge of Linux terminal commands and networking concepts
#Configuring IPv6 on a Linux dedicated server
Below are the steps involved in configuring IPv6 on a Linux dedicated server.
#Step 1: Verify IPv6 support
First, check if your server has IPv6 enabled and if the kernel supports it.
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
Output0
- 0 means IPv6 is enabled.
- 1 means IPv6 is disabled.
If the output is 1, enable IPv6 by running:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
#Step 2: Check current network configuration
Verify the network interfaces and their current IPv6 configuration.
ip -6 addr show
Output1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp0s1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 fd7d:106f:a73e:8d9c:b310:2e19:39e5:628f/64 scope global temporary dynamic
valid_lft 604028sec preferred_lft 85297sec
inet6 fd7d:106f:a73e:8d9c:8483:b6ff:feae:3a4c/64 scope global dynamic mngtmpaddr
valid_lft 2591974sec preferred_lft 604774sec
inet6 fe80::8483:b6ff:feae:3a4c/64 scope link
valid_lft forever preferred_lft forever
- lo is the loopback interface with ::1/128.
- enp0s1 (or your interface name) may show a link-local address (fe80::/64) or/and a Unique Local Address (fd7d::/64). If no global IPv6 address (e.g., 2001:db8::) appears, you need to configure one.
#Step 3: Configure IPv6 address
Ubuntu 24 uses Netplan for network configuration. Netplan configuration files are located in /etc/netplan/.
#Check Existing Netplan Configuration
List the Netplan configuration files:
ls /etc/netplan/
Output50-cloud-init.yaml 01-network-manager-all.yaml
#Backup the Configuration
Always back up the existing configuration:
sudo cp /etc/netplan/01-network-manager-all.yaml /etc/netplan/01-network-manager-all-yaml.backup
#Edit the Netplan Configuration
Open the Netplan file for editing:
sudo nano /etc/netplan/01-network-manager-all.yaml
Add or modify the IPv6 configuration under the appropriate interface. Here’s an example configuration:
network:
version: 2
renderer: NetworkManager
ethernets:
enp0s1:
dhcp4: no
addresses:
- 192.168.2.107/24
- 2001:db8:abcd:0012::1/64
routes:
- to: default
via: 192.168.2.1
- to: default
via: "2001:db8:abcd:0012::1"
nameservers:
addresses:
- 8.8.8.8
- 2001:4860:4860::8888
Here, I am configuring the address starting with 2001 to use publicly routable IPv6 addresses. 2001:4860:4860::8888 is the address of Google DNS that your server will use to translate domain names into IP addresses, facilitating outbound connections to other services on the internet.
Below are the details of configuration parameters:
- addresses: Specifies the static IPv6 address and subnet
- nameservers: Lists IPv6 DNS servers
- Save the file (Ctrl+O, Enter, Ctrl+X in nano)
#Step 4: Apply the Netplan configuration
Test and apply the new configuration:
sudo netplan try
OutputDo you want to keep these settings?
Press ENTER before the timeout to accept the new configuration
Changes will revert in 88 seconds
Press Enter to accept. If there are errors, Netplan will revert after 120 seconds, allowing you to fix the configuration.
If the test is successful, apply the configuration permanently:
sudo netplan apply
#Step 5: Verify IPv6 configuration
Check if the IPv6 address is assigned:
ip -6 addr show
Outputubuntu@ubuntu:~$ ip -6 addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp0s1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2001:db8:abcd:12::1/64 scope global
valid_lft forever preferred_lft forever
Check the routing table:
ip -6 route
Output2001:db8:abcd:12::/64 dev enp0s1 proto kernel metric 256 pref medium
#Step 6: Test IPv6 connectivity
Test connectivity to an IPv6-enabled server (e.g., Google’s DNS server):
ping6 google.com
OutputPING google.com(2404:6800:4003:c01::8b) 56 data bytes
64 bytes from 2404:6800:4003:c01::8b: icmp_seq=1 ttl=117 time=12.3 ms
#Step 7: Configure the firewall for IPv6
Ubuntu 24 uses UFW (Uncomplicated Firewall) by default. Ensure IPv6 is enabled in UFW.
#Enable IPv6 in UFW
Edit the UFW configuration:
sudo nano /etc/default/ufw
Ensure the IPV6 setting is enabled:
IPV6=yes
Save and exit the file.
#Allow necessary ports
For example, allow SSH (port 22) and HTTP (port 80):
sudo ufw allow proto tcp to any port 22
OutputRules updated
Rules updated (v6)
sudo ufw allow proto tcp to any port 80
OutputRules updated
Rules updated (v6)
Reload UFW:
sudo ufw reload
OutputFirewall reloaded
sudo ufw status
OutputStatus: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
#Conclusion
When configuring IPv6 on a dedicated Ubuntu 24 server, the main steps are to verify that a feature is supported in the kernel. Following these instructions, your server would become IPv6-ready and make it work in the new networks. To maintain a healthy configuration, you have to frequently consult documentation about the concrete IPv6 configuration at your hosting provider and fiddle to maintain connectivity.
Bare Metal Servers - 15 Minute Deployment
Get 100% dedicated resources for high-performance workloads.