Adding a Public IPv6 Address to a Linux Server (Ubuntu)

To configure an additional public IP address in Ubuntu, proceed as follows:

Prerequisites: 

You wrote down the main IPv4 address.

You have assigned a main IPv6 address and an additional IPv6 address to the server.

You have logged in to the server as an administrator.

Step 1

To add the main IPv6 address, you must add in /etc/network/interfaces the following entries:

allow-hotplug ens192
# IPV6 Setup
iface ens192 inet6 static
accept_ra 0
address HAUPT-IPv6-ADRESSE
netmask 64
gateway fe80::1
iface ens192 inet6 static

Example:

vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens192
iface ens192 inet dhcp
# IPV6 Setup
iface ens192 inet6 static
accept_ra 0
address 2001:ba0:2020:1cc:3fe0:4d12:cd52:491a
netmask 64
gateway fe80::1
Step 2

To add the additional IPv6 address, you must specify in /etc/network/interfaces insert the following additional entries:

iface ens192 inet6 static
accept_ra 0
address Zusätzliche-IPv6-ADRESSE
netmask 64
gateway fe80::1

Example:

vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens192
iface ens192 inet dhcp
# IPV6 Setup
iface ens192 inet6 static
accept_ra 0
address 2001:ba0:2020:1cc:3fe0:4d12:cd52:491a
netmask 64
gateway fe80::1
iface ens192 inet6 static
accept_ra 0
address 2001:ba0:2020:1cc:b62d:b9ef:e843:a0c1
netmask 64
gateway fe80::1

Please note: To configure multiple additional IPv6 addresses, enter them in the IPV6ADDR_SECONDARIES= entry and separate them with a space.

Step 3

To restart the network, enter the following command:

/etc/init.d/networking restart
Step 4

To check whether the additional IPv6 address has been assigned to the server, type the following command:

ifconfig eth0