How to add additional IPv6 on your server

Temporary setting of additional IPv6 addresses

Support for additional IPv6 addresses should be set manually.

First of all, add all needed IPv6 addresses to the server's net device. Then, connect by ssh to the server.

In order to set the net device of your server, choose the address from given range of addresses and add it with this command:

ip -6 addr add <new_IPv6_address_in_range>/48 dev ens3

Note that <new_IPv6_address_in_range> is a placeholder. Replace it with an actual IP.
Instead of <new_IPv6_address_in_range> we used 2a10:c941:100:3c9::2

The new address will be added instantly. You can find this out by running this command:

ip a

And get an output like this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:ef:a7:9f brd ff:ff:ff:ff:ff:ff
altname enp0s3
inet 5.189.253.86/24 brd 5.189.253.255 scope global ens3
valid_lft forever preferred_lft forever
inet6 2a10:c941:100:3c9::2/48 scope global
valid_lft forever preferred_lft forever
inet6 2a10:c941:100:3c9::1/48 scope global
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:feef:a79f/64 scope link
valid_lft forever preferred_lft forever


This address will be valid ONLY FOR THIS SESSION. In order to make changes last for next sessions, you should edit some config files.

Lasting IPv6's in Debian/Ubuntu

In such GNU/Linux distributions as Debian and Ubuntu you should edit a config file that is responsible for setting your network on boot - /etc/network/interfaces.

Edit the file with root privileges:

sudo nano /etc/network/interfaces

This file has config sections for various networks (e.g. public IPv4, public IPv6, private IPv4)
Default interfaces file might look like this:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens3
iface ens3 inet static
address 5.189.253.86
netmask 255.255.255.0
gateway 5.189.253.1
hwaddress ether 52:54:00:EF:A7:9F
dns-nameservers 8.8.8.8 1.1.1.1
iface ens3 inet6 static
address 2a10:c941:100:3c9::1
netmask 48
gateway 2a10:c941:100::1
dns-nameservers 8.8.8.8 1.1.1.1

Search for public IPv6 section:

iface ens3 inet6 static
address 2a10:c941:100:3c9::1
netmask 48
gateway 2a10:c941:100::1
dns-nameservers 8.8.8.8 1.1.1.1


Add the new address here. Create a new section which will include the new IPv6 address and the subnet mask.

iface ens3 inet6 static
address 2a10:c941:100:3c9::1
netmask 48
gateway 2a10:c941:100::1
dns-nameservers 8.8.8.8 1.1.1.1
iface ens3 inet6 static
address <new_IPv6_address_in_range>
netmask 48

Again, instead of <new_IPv6_address_in_range> we used 2a10:c941:100:3c9::2

Save and exit editing.
Server should add the new addresses automatically on the next boot.

Run this if you want to apply changes without rebooting your VM:

systemctl restart networking

To check if changes were made run this command:

ip a

And get an output like this:


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:ef:a7:9f brd ff:ff:ff:ff:ff:ff
altname enp0s3
inet 5.189.253.86/24 brd 5.189.253.255 scope global ens3
valid_lft forever preferred_lft forever
inet6 2a10:c941:100:3c9::2/48 scope global
valid_lft forever preferred_lft forever
inet6 2a10:c941:100:3c9::1/48 scope global
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:feef:a79f/64 scope link
valid_lft forever preferred_lft forever

Lasting IPv6's in CentOS

There are no big differences in adding new addresses in CentOS GNU/Linux. File responsible for this setting is /etc/sysconfig/network-scripts/ifcfg-eth0.

Edit it with root privileges:

sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0

IPv6 section looks like this:

BOOTPROTO="none"
DEVICE="eth0"
HWADDR="52:54:00:EF:A7:9F"
ONBOOT="yes"
IPADDR="5.189.253.86"
NETMASK="255.255.255.0"
GATEWAY="5.189.253.1"
DNS1=8.8.8.8
DNS2=1.1.1.1
IPV6INIT="yes"
IPV6ADDR="2a10:c941:100:3c9::1/48"
IPV6_DEFAULTGW="2a10:c941:100::1"

This is the variable that holds new IPv6 addresses:

IPV6ADDR_SECONDARIES

It allows to allocate a string of secondary IPv6 addresses. This is how it looks in the config:

BOOTPROTO="none"
DEVICE="eth0"
HWADDR="52:54:00:EF:A7:9F"
ONBOOT="yes"
IPADDR="5.189.253.86"
NETMASK="255.255.255.0"
GATEWAY="5.189.253.1"
DNS1=8.8.8.8
DNS2=1.1.1.1
IPV6INIT="yes"
IPV6ADDR="2a10:c941:100:3c9::1/48"
IPV6_DEFAULTGW="2a10:c941:100::1"
IPV6ADDR_SECONDARIES="2a10:c941:100:3c9::2/48 2a10:c941:100:3c9::3/48 .../48"


Save and exit editing the file.
Server should add the new addresses automatically on the next boot.


After that run this to apply changes:
systemctl restart network

To check if changes were made run this command:

ip a

And get an output like this:


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:ef:a7:9f brd ff:ff:ff:ff:ff:ff
inet 5.189.253.86/24 brd 5.189.253.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 2a10:c941:100:3c9::3/48 scope global
valid_lft forever preferred_lft forever
inet6 2a10:c941:100:3c9::2/48 scope global
valid_lft forever preferred_lft forever
inet6 2a10:c941:100:3c9::1/48 scope global
valid_lft forever preferred_lft forever

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Create Reverse DNS in the VMmanager

Reverse DNS uses PTR records to map an IP address to a Fully Qualified Domain Name (FQDN)....

How to connect to a virtual server via VNC, where can I find access from VNC?

To connect to virtual server via VNC, you need to do the following steps:a) Go to VMmanager...

How to reinstall OS on my virtual server?

a) Go to VMmanager (https://vm.llhost-inc.com or Client Area > Services > My services >...

How to restart my virtual server?

In order to reboot a virtual virtual server, you must perform the following steps: a) Go to...

What is Recovery Mode?

Recovery Mode - is used to start the virtual server from the LiveCD image of SystemRescueCD...