Static IPv6 Configuration on CentOS 7

  1. Enabling IPv6

IPv6 enabled on CentOS 7 by default. You can verify status

# cat /proc/net/if_inet6 

00000000000000000000000000000001 01 80 10 80 lo 24015a40000000120000000000000100 02 40 00 80 ens33 fe80000000000000020c29fffe5c6601 03 40 20 80 ens38 fe80000000000000020c29fffe5c66f7 02 40 20 80 ens33

If /proc/net/if_inet6 doesn’t exist try to load the kernel module

# modprobe ipv6
# lsmod | grep ipv6

or add grub entry (reboot required)

# echo 'GRUB_CMDLINE_LINUX="ipv6.disable=0"' /etc/default/grub
# grub2-mkconfig -o /boot/grub2/grub.cfg
# shutdown -r now

also make sure ipv6 isn’t disabled manually in kernel

# sysctl net.ipv6.conf.all.disable_ipv6 = 0
# sysctl net.ipv6.conf.default.disable_ipv6 = 0
# sysctl -p

 

2. Configuring static IPv6. 
# vi /etc/sysconfig/network-scripts/ifcfg-ens33

#append below lines
NM_CONTROLLED=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6ADDR="2000:5a40:0:12::100/64"
IPV6_DEFAULTGW=2000:5a40:0:12::1

# systemctl disable NetworkManager
# systemctl stop NetworkManager
# systemctl enable network
# systemctl start network
3. Verification
# ip a s | grep inet6

inet6 ::1/128 scope host 
inet6 2000:5a40:0:12::100/64 scope global 
inet6 fe80::20c:29ff:fe5c:66f7/64 scope link 
inet6 fe80::20c:29ff:fe5c:6601/64 scope link

#ip -6 add show | grep inet6

inet6 ::1/128 scope host 
inet6 2000:5a40:0:12::100/64 scope global 
inet6 fe80::20c:29ff:fe5c:66f7/64 scope link 
inet6 fe80::20c:29ff:fe5c:6601/64 scope link

#ip -6 route show

unreachable ::/96 dev lo metric 1024 error -113 
2000:5a40:0:12::/64 dev ens33 proto kernel metric 256 
unreachable 3ffe:ffff::/32 dev lo metric 1024 error -113 
fe80::/64 dev ens33 proto kernel metric 256 
fe80::/64 dev ens38 proto kernel metric 256
default via 2000:5a40:0:12::1 dev eth1 metric 1 pref medium

# ping6 2000:5a40:0:12::1 -c 1

PING 2000:5a40:0:12::1(2000:5a40:0:12::1) 56 data bytes
64 bytes from 2000:5a40:0:12::1: icmp_seq=1 ttl=64 time=2.03 ms

--- 2000:5a40:0:12::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.032/2.032/2.032/0.000 ms

 

One Reply to “Static IPv6 Configuration on CentOS 7”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.