This tutorial shows how to set up an IPv6 address by hand on a VPS in the Hukot.net network, on Windows, AlmaLinux, Debian, Ubuntu and FreeBSD. The examples use these addresses:
| What | Address |
|---|---|
| Hukot.net network | 2a02:25b0:aaaa::/48 |
| Main IP address | 2a02:25b0:aaaa:CAFE::CAFE |
| Secondary IP address | 2a02:25b0:aaaa:CAFE::1234 |
| Gateway | 2a02:25b0:aaaa::1 |
Replace CAFE with the range Hukot.net assigned to you. The addresses are set with the /48 mask of the whole network, because only then is the gateway 2a02:25b0:aaaa::1 directly reachable. The secondary address is optional; it shows what to do if you want more than one IPv6 address.
On Linux and FreeBSD, run the commands as root; on Windows, in PowerShell run as administrator.
A wrong network setting can cut off your SSH or Remote Desktop connection. Before you start, make sure you can reach the server console.
Setup #
-
Find the name of the interface you are going to configure:
netsh interface show interfaceThe output can look like this:
Admin State State Type Interface Name ------------------------------------------------------------------------- Enabled Connected Dedicated Ethernet -
Set the addresses:
netsh interface ipv6 set global randomizeidentifiers=disabled netsh interface ipv6 add address "Ethernet" 2a02:25b0:aaaa:CAFE::CAFE/48 netsh interface ipv6 add address "Ethernet" 2a02:25b0:aaaa:CAFE::1234/48 -
Set the gateway:
netsh interface ipv6 add route ::/0 "Ethernet" 2a02:25b0:aaaa::1 -
Set the DNS servers:
netsh interface ipv6 add dnsserver "Ethernet" 2001:4860:4860::8888 netsh interface ipv6 add dnsserver "Ethernet" 2001:4860:4860::8844 index=2
Replace Ethernet with the interface name from the first step.
-
Find the name of the network connection:
nmcli connection show -
Set the addresses and the gateway, then activate the connection again:
nmcli connection modify "<connection>" ipv6.method manual ipv6.addresses "2a02:25b0:aaaa:CAFE::CAFE/48, 2a02:25b0:aaaa:CAFE::1234/48" ipv6.gateway 2a02:25b0:aaaa::1 nmcli connection up "<connection>"
Replace <connection> with the name from the first step (the NAME column, for example eth0 or System eth0). This works on AlmaLinux, Rocky Linux and RHEL 8 or newer.
-
Find the interface name (for example
eth0orens18):ip link -
Add these lines to the end of
/etc/network/interfaces:iface eth0 inet6 static address 2a02:25b0:aaaa:CAFE::CAFE/48 gateway 2a02:25b0:aaaa::1 up ip -6 addr add 2a02:25b0:aaaa:CAFE::1234/48 dev eth0 -
Restart networking:
systemctl restart networking
Replace eth0 with the interface name from the first step.
-
Open the network configuration in
/etc/netplan/(usually a single file, for example50-cloud-init.yaml). -
Add the IPv6 addresses to the interface's
addresseslist and the default route to itsrouteslist. Keep the existing IPv4 addresses and routes:network: version: 2 ethernets: eth0: addresses: - 2a02:25b0:aaaa:CAFE::CAFE/48 - 2a02:25b0:aaaa:CAFE::1234/48 routes: - to: "::/0" via: "2a02:25b0:aaaa::1" -
Try the configuration:
netplan tryIf the connection still works, confirm with Enter. Without confirmation, netplan goes back to the previous configuration after two minutes.
-
Find the interface name (for example
vtnet0orem0):ifconfig -
Add these lines to
/etc/rc.conf:ifconfig_vtnet0_ipv6="inet6 2a02:25b0:aaaa:CAFE::CAFE prefixlen 48" ifconfig_vtnet0_alias0="inet6 2a02:25b0:aaaa:CAFE::1234 prefixlen 48" ipv6_defaultrouter="2a02:25b0:aaaa::1" -
Restart networking and routing:
service netif restart && service routing restart
Replace vtnet0 with the interface name from the first step.
Verification #
Check that the server reaches the internet over IPv6:
ping -6 -c 4 2001:4860:4860::8888
On Windows, use ping -6 2001:4860:4860::8888. If replies come back, IPv6 is set up.