Linux – How to Disable IPv6 Support Entirely

debianipv4ipv6linuxlinux-kernel

We are currently setting up a some local network servers to run in a full ipv4 network. I can be sure, that this network don't have ipv6 support, and never will.

Next to that,

  • partially because of a command from higher organisational levels,
  • partially because we must guarantee, it never will cause any interference,

we need to somehow completely disable the ipv6 support on the kernels of there linux servers.

Yes, I can google for some sysctl settings, but it wasn't enough. For example, in the default settings of the /etc/hosts, I've also found some ipv6 records. I won't let it to cause some trouble in the future.

What exactly need to be done, to remove the whole ipv6 support from a fresh installed debian entirely? The best were a checklist/todo list, but any other form were also okay.

I checked the config files in /etc a lot, but I can't be sure I've found everything.

Any better ideas? Is there any "checklist", what need to be set up?

Best Answer

Either the sysctl lines in /etc/sysctl.conf

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

and/or the GRUB line in /etc/default/grub

GRUB_CMDLINE_LINUX="ipv6.disable=1"

will disable ipv6 support at the system level and should be enough. If your applications still attempt to connect via ipv6, then that's the application's fault and needs to be addressed with the vendor.

The /etc/hosts file entry isn't relevant.