Adding a Public IPv6 Address to a Linux Server (CentOS 7)

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

Please note:

You wrote down the main IPv4 address.

You have assigned 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 insert the following entries in /etc/sysconfig/network-scripts/ifcfg-ens192:

Networking_IPV6="yes"
DHCPV6C="no"
IPV6INIT="yes"
IPV6_AUTOCONF="no"
IPV6ADDR=HAUPT-IPv6-ADRESSE/64
IPV6_DEFAULTGW=fe80::1%ens192

Example:

vi /etc/sysconfig/network-scripts/ifcfg-ens192
DHCP_HOSTNAME="localhost.localdomain"
DEVICE="ens192"
BOOTPROTO="dhcp"
Networking_IPV6="yes"
DHCPV6C="no"
IPV6INIT="yes"
IPV6_AUTOCONF="no"
IPV6ADDR=2001:ba0:2020:bce5:cdb:a034:601e:e952/64
IPV6_DEFAULTGW=fe80::1%ens192
NM_CONTROLLED="no"
ONBOOT="yes"
Step 2

To add the additional IPv6 address, you must specify in /etc/sysconfig/network-scripts/ifcfg-ens192 the entry IPV6ADDR_SECONDARIES= and the additional IPv6 address. Example:

vi /etc/sysconfig/network-scripts/ifcfg-ens192
DHCP_HOSTNAME="localhost.localdomain"
DEVICE="ens192"
BOOTPROTO="dhcp"
Networking_IPV6="yes"
DHCPV6C="no"
IPV6INIT="yes"
IPV6_AUTOCONF="no"
IPV6ADDR=2001:ba0:2020:bce5:cdb:a034:601e:e952/64
IPV6_DEFAULTGW=fe80::1%ens192
IPV6ADDR_SECONDARIES=2001:ba0:2020:bce5:678f:bcca:b152:a6ae/64
NM_CONTROLLED="no"
ONBOOT="yes"

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/network restart
Step 4

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

ifconfig ens192