Page 1 of 1

CentOS 7: IPv6 standard configuration

Posted: 2023 May 03, 21:04
by Mihai
Assign POOL/64 IPv6 and add two additional predefined v6 IPs on the eth0 interface

Edit configuration file for eth0

Code: Select all

[root @ CentOS7]$ vim /etc/sysconfig/network-scripts/ifcfg-eth0
Configuration example

Code: Select all

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.10.10.10
NETMASK=255.255.255.0
GATEWAY=10.10.10.1
DNS1=8.8.8.8
IPV6INIT=yes
IPV6ADDR="2001:19f0:6c01:f7e:5400:01ff:fe47:d16e/64"
IPV6ADDR_SECONDARIES="2001:19f0:6c01:f7e::1/128 2001:19f0:6c01:f7e::2/128"
IPV6_AUTOCONF="yes"
DNS2=2001:19f0:300:1704::6
The configuration above contains an IPv4 and a POOL of IPv6/64 ips. This POOL with netmask /64 is based on the following IP range

Code: Select all

Start Range: 2001:1960:6c01:f7e:0:0:0:0
End Rage: 2001:1960:6c01:f7e:ffff:ffff:ffff:ffff
In the configuration I also added two secondary v6 IPs that are used for other purposes. (IPV6ADDR_SECONDARIES)

NOTE: The configuration for v6 IPs allows adding several IPs, IPv6 POOLs, on the same interface, which means that it is not necessary to create several virtual interfaces for their assignment.

Edit configuration file /etc/sysctl.conf and add (if not existing) the following configuration lines

Code: Select all

net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.eth0.accept_ra=2
Restart the network service

Code: Select all

[root @ CentOS7]$ systemctl restart network
Check interface eth0 IPs

Code: Select all

[root @ CentOS7]$ ifconfig eth0
Output example

Code: Select all

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.1.10.10  netmask 255.255.255.0  broadcast 10.1.10.255
        inet6 fe80::5400:1ff:fe47:d16e  prefixlen 64  scopeid 0x20<link>
        inet6 2001:19f0:6c01:f7e::2  prefixlen 128  scopeid 0x0<global>
        inet6 2001:19f0:6c01:f7e::1  prefixlen 128  scopeid 0x0<global>
        inet6 2001:19f0:6c01:f7e:5400:1ff:fe47:d16e  prefixlen 64  scopeid 0x0<global>
        ether 56:00:01:47:d1:6e  txqueuelen 1000  (Ethernet)
        RX packets 288590  bytes 223876968 (213.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 172621  bytes 90365946 (86.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0