Here’s a technique to disable IPv6 on Linux radically. The method works both for Ubuntu, Red Hat, CentOS and Fedora and should also work for other distributions.
Before you begin, you must first verify that IPv6 is active on your system with the following command (1 = inactive, 0 = enabled):
Then, to disable IPv6, it will modify the /etc/sysctl.conf as root like this:
# IPv6 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
Then reload the conf like this (again as root):
IPv6 is now disabled on your operating system.