2

Following some tutorials to disable ipv6 in my laptop (Ubuntu 16.04), I needed to write in /etc/sysctl.d/99-sysctl.conf the following lines:

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

I run sudo sysctl -p and ipv6 is disabled. Fine.

After some time, or if I restart NetworkManager, or reboot my computer, I find in ifconfig that my ipv6 address got back, and I have to run sudo sysctl -p again.

So I cannot understand why my configuration is not definitive and something ignores my kernel parameters at runtime.

DdD
  • 121
  • 1
  • 3
  • After creating 99-sysctl.conf, did you `sudo service procps start`? – Charles Green Nov 09 '17 at 16:59
  • @CharlesGreen will putting it in the sysctl.conf make a difference? – George Udosen Nov 09 '17 at 17:12
  • @George I don't remember if I did it on purpose but `sysctl.d/99-sysctl.conf` and `sysctl.conf` are identical. So there is no difference. – DdD Nov 09 '17 at 17:25
  • @CharlesGreen if I do `sudo service procps status` I can see that is already active, moreover I can restart it and it fix ipv6 temporarily, until NetworkManager is restarted, then it gets back its ipv6. – DdD Nov 09 '17 at 17:29
  • Why would you create `/etc/sysctl.d/99-sysctl.conf`, if it is identical to `/etc/sysctl.conf`? The reason for my suggestion of `procps` can be found in `/etc/sysctl.d/README` – Charles Green Nov 09 '17 at 17:43
  • @CharlesGreen Yes i eliminated one of the two (first one then the other) and I run sudo service procps start, but the behavior remains. The parameters don't look permanent. – DdD Nov 09 '17 at 22:10
  • There is an alternate method for disabling ipv6 which worked well for me when I was having some problems [https://askubuntu.com/a/337736/283721](https://askubuntu.com/a/337736/283721) – Charles Green Nov 09 '17 at 22:56
  • Also, there is an older bug report which I assume would have been fixed by now, and which may be applicable to your system [https://serverfault.com/a/494899](https://serverfault.com/a/494899) – Charles Green Nov 09 '17 at 23:00
  • @DdD on my Debian, sysctl.d/99-sysctl.conf is symlinked to sysctl.conf. – pietrodn May 14 '18 at 06:55

1 Answers1

4

There is a reported problem affecting up to Ubuntu 16.04, at https://bugs.launchpad.net/ubuntu/+source/procps/+bug/50093 in which procps.sh which applies the sysctl.conf variable is run too early, and some settings are not applied.

An alternate method for disabling ipv6 is to use a kernel boot parameter as outlines in https://askubuntu.com/a/337736/283721

sudo nano /etc/default/grub

Find the line that contain "GRUB_CMDLINE_LINUX_DEFAULT":

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Add "ipv6.disable=1" to the boot option, then save your grub file:

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"

press ctrl+o to save, and ctrl+x to exit nano. Finally, update grub:

sudo update-grub

and reboot to load the changes.

Charles Green
  • 20,952
  • 21
  • 60
  • 92