To configure an additional public IPv6 address in CentOS 7, proceed as follows:
Prerequisites:
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.
- 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=MAIN IPv6 ADDRESS/64
IPV6_DEFAULTGW=fe80::1%ens192
Example:
[root@localhost ~]# 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"
- To add the additional IPv6 address, you must specify in /etc/sysconfig/network-scripts/ifcfg-ens192 the entryIPV6ADDR_SECONDARIES= and the additional IPv6 address. Example:
[root@localhost ~]# 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"
Note: To configure multiple additional IPv6 addresses, enter them in the IPV6ADDR_SECONDARIES= entry and separate them with a space.
- To restart the network, enter the following command:
[root@localhost /]# /etc/init.d/network restart
- To check whether the additional IPv6 address has been assigned to the server, type the following command:
[root@localhost /]# ifconfig ens192