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

To configure an additional public IP address in CentOS 6, 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 insert the following entries in /etc/sysconfig/network-scripts/ifcfg-eth0:

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

Example:

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
NETWORKING_IPV6="yes"
DHCPV6C="no"
IPV6INIT="yes"
IPV6_AUTOCONF="no"
IPV6ADDR=2001:ba0:2020:53c8:ac66:35c6:7a84:bd18/64
IPV6_DEFAULTGW=fe80::1%eth0
MTU="1500"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
Step 2

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

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
NETWORKING_IPV6="yes"
DHCPV6C="no"
IPV6INIT="yes"
IPV6_AUTOCONF="no"
IPV6ADDR=2001:ba0:2020:53c8:ac66:35c6:7a84:bd18/64
IPV6_DEFAULTGW=fe80::1%eth0
IPV6ADDR_SECONDARIES=2001:ba0:2020:53c8:cb04:94a5:24d:23ff
MTU="1500"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"

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 eth0