Developer's Lab

By Diogo Pinto - DiØ

Disable IPv6 on Linux

IPv6 protocol is not always available in the local area network(lan), to avoid your DHCP connection configure IPv6 in your network card device, you can disable it through least two ways:

Command line

sysctl command is an Linux command that configures kernel parameters at runtime. You can display all values currently available, typing sysctl -a. More details, see sysctl manual page.

Regarding configuration, with super admin user, type:

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w sysctl -w net.ipv6.conf.default.disable_ipv6=1

If you want re-enable IPv6, issue the following commands:

sysctl -w net.ipv6.conf.all.disable_ipv6=0
sysctl -w net.ipv6.conf.default.disable_ipv6=0

File configuration(Debian based distro)

Another way, is through of the file configuration located under directory /etc/. The file name is sysctl.conf, which is a simple file containing sysctl values to be read in and set by sysctl.

With super admin user, edit the file /etc/sysctl.conf and add the following lines:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

To disable, just remove the above lines.