IPv6 is enabled by default on most Linux distros. However, IPv6 is not used for some situations for most of time and it may cause troubles and requires effort to protect the network and ensure the security. This post introduces how to disable IPv6 support on Linux (newer modern Kernel versions).
First, add these lines to /etc/sysctl.conf:
net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1 net.ipv6.conf.lo.disable_ipv6=1
IPv6 on Linux can be easily configured via sysctrl. To make it take effect, run as root:
To verify, check the network interfaces whether IPv6 addresses disappear by
You may also check that the kernel variable contains 1:
The settings are in sysctl.conf and after restarts, Linux will load them and the settings will still take effect.