Debian: Disable IPv6

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
^rooker
Site Admin
Posts: 1481
Joined: Fri Aug 29, 2003 8:39 pm

Debian: Disable IPv6

Post by ^rooker »

For internal network computers, I disable IPv6 in most cases.

This here is basically just a copy of the "How to turn off IPv6" section on the Debian Wiki:

1) Edit /etc/sysctl.conf
and add the following parameters to kernel:

Code: Select all

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Note: This disables IPv6 on all network interfaces.
Optional: If you want to only disable it on specific ones, you can use a syntax like this:

Code: Select all

net.ipv6.conf.eth0.disable_ipv6 = 1
(This would apply only to "eth0" for example)

2) Apply changes:
After editing sysctl.conf, you should run sysctl -p to activate changes or reboot system.

That's it.
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
User avatar
^rooker
Site Admin
Posts: 1481
Joined: Fri Aug 29, 2003 8:39 pm

IPv6: use "/etc/sysctl.d"

Post by ^rooker »

Another option that I now find slightly cleaner than modifying "/etc/sysctl.conf" directly, is to use the "/etc/sysctl.d" folder to keep this config separately (and easier to enable/disable it).

1) Create a file called "/etc/sysctl.d/70-disable-ipv6.conf"

2) Put the same lines in that file as you would into sysctl.conf directly

3) Save it and either reboot or reload sysctl:

Code: Select all

$ sysctl -p -f /etc/sysctl.d/70-disable-ipv6.conf
Feels cleaner :D
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply