Disabling IPv6 on CentOS 7.5 is easy. This method was tested on a virtual server running in DigitalOcean and persists after reboots. First, let’s check to see that IPv6 is in fact enabled in a default CentOS 7.5 virtual server:
[root@server ~]# ifconfig -a | grep inet6 inet6 fe80::xxxx:xxxx:xxxx:xxxx prefixlen 64 scopeid 0x20 inet6 ::1 prefixlen 128 scopeid 0x10[root@server ~]#
Next, let’s issue the following commands to disable IPv6:
[root@server ~]# echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf [root@server ~]# echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf
To make the changes active and verify, let’s reboot the server:
[root@server ~]# shutdown -r now
Finally, we can verify that IPv6 is no longer active on the virtual server:
[root@server ~]# ifconfig -a | grep inet6 [root@server ~]#
It’s that easy!