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 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
  • 21,339