How to Disable IPv6 on Linux
Posted on In Linux, NetworkIPv6 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:
sysctl -p
To verify, check the network interfaces whether IPv6 addresses disappear by ifconfig
.
You may also check that the kernel variable contains 1:
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
The settings are in sysctl.conf and after restarts, Linux will load them and the settings will still take effect.
Nice try, but the correct config parameters are:
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
between disable and ipv6 you have to paste an underscore
Thanks for pointing this out. It is a formatting problem after the site changes to be using markdown. `_` is treated as a formatting character. It is fixed now.