How to disable IPv6 on Debian Wheezy?

26

9

I know there's a wiki entry http://wiki.debian.org/DebianIPv6#How_to_turn_off_IPv6 that shows how to disable IPv6 in Debian Squeeze, but that's a 2.6.* kernel.

What about 3.2.* kernels running Wheezy?

JohnnyFromBF

Posted 2013-02-05T08:33:11.200

Reputation: 4 298

at least '/sys/module/ipv6/parameters/disable_ipv6' still exists for Kernel 3.2.0xxx – sparkie – 2013-02-05T10:38:44.010

@sparkie yeah but http://wiki.debian.org/DebianIPv6#How_to_turn_off_IPv6 says nothing about /sys/module/ipv6/parameters/disable_ipv6 but /etc/sysctl.d/disableipv6.conf

– JohnnyFromBF – 2013-02-05T14:18:32.073

Answers

29

If you do sysctl -p, the reboot isn't necessary. It worked for me, but I prefer to keep params in single file, so I put the line above in the sysctl.conf file.

Just to be sure, I put a line about every device, so my solution is adding the following 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
net.ipv6.conf.eth0.disable_ipv6 = 1
net.ipv6.conf.eth1.disable_ipv6 = 1
net.ipv6.conf.ppp0.disable_ipv6 = 1
net.ipv6.conf.tun0.disable_ipv6 = 1

Gwyll

Posted 2013-02-05T08:33:11.200

Reputation: 391

13Isn't net.ipv6.conf.all.disable_ipv6 = 1 enough? At least iIt did the trick for all interfaces on my machine. – Eugene Beresovsky – 2015-04-16T23:14:55.653

2Thanks for this! For some reason, on my Raspberry Pi just disabling via net.ipv6.conf.all.disable_ipv6 didn't work; adding an explicit line for my adapter did the trick! – Doktor J – 2016-06-12T19:05:34.777

Same here: it didn't work using net.ipv6.conf.all.disable_ipv6; had to use a line specific for my adapter like this: net.ipv6.conf.enp6s0.disable_ipv6 = 1 – Bruno – 2018-08-24T16:13:08.643

13

Disabling IPv6 on more recent systems works the same way as described in the Debian wiki:

Disable ipv6 in kernel : echo net.ipv6.conf.all.disable_ipv6=1 > /etc/sysctl.d/disableipv6.conf will disable ipv6 at next reboot.

Keep in mind that, whatever problem you are having, this should be an absolute last resort after you have exhausted all other options for fixing the problem. IPv6 is not optional and you will have to turn it back on sooner or later.

Michael Hampton

Posted 2013-02-05T08:33:11.200

Reputation: 11 744

@MichaelHampton OpenVZ isn't a VM system, it's a container/chroot jail-based system, which is probably why you can't mess with its network settings like this... – Jules – 2016-04-10T01:27:19.590

@Jules Thanks, but I already know exactly what OpenVZ is. – Michael Hampton – 2016-04-10T01:29:41.037

Interestingly I still have ipv6 showing up after following the instructions and verifying the settings listed on the wiki pages persisted after reboots. It might have something to do with the fact that this is running on a vm hosted by someone else. – ConstantineK – 2013-12-06T16:44:24.110

@hobs Yes, some VM providers restrict what changes can be made to the guest's network configuration. Typically OpenVZ based ones. In this case, you definitely should forget about disabling IPv6 and instead try to resolve the actual problem. – Michael Hampton – 2014-02-04T14:40:21.123

Definitely. I had no interest in doing this but as you may know, many legacy pieces of software with no future development have issues, and that is what I was working with. So, I wish! – ConstantineK – 2014-02-04T14:46:03.160

This didn't work for me. Jawa's approach did work though. I'm using BAMT1.1, not really sure which version of debian it's based on. – womp – 2014-02-27T06:16:01.207