if I issue
sysctl net.ipv6.conf.all.disable_ipv6=1 from the command line after the system has started, I get the result I want -- IPv6 is indeed disabled.
Now for the problem of making this behavior persistent after a reboot.
It is easy to find suggestions for how to do this, usually they revolve around putting
net.ipv6.conf.all.disable_ipv6=1 in a file in the
/etc/sysctl.d/ directory or in the config file for sysctl itself, namely
/etc/sysctl.conf. Other approaches mentioned include adding
This is mentioned e.g. here:
I've tried all of these, they don't work.
ifconfig clearly shows that IPv6 is enabled for the interface. Again, if I just do a manual
sysctl after booting, it disables it as expected.
sysctl -p does nothing for me, only writing the command verbatim as above works.
I've also tried putting the
sysctl command in
/etc/rc.local, which I know runs correctly from observing other commands I can put there. However, despite executing, it doesn't seem to take effect.
I've also tried other commands instead of just
all.disable_ipv6, such as
enp0s3.disable_ipv6 (I've verified that enp0s3 is indeed my Ethernet interface).
This seems a bit similar to https://bugs.launchpad.net/ubuntu/+source/linux/+bug/997605 to me, but I have no idea why this happens. I'm confident that all I had to do on a different system was simply to put this in a file in /etc/sysctl.d/.
One way to disable this which I already know of, beyond what I've tried, would be to recompile the kernel manually without IPv6 support. However, this is simply too much of a kludge, it is not reliable, and it is too much work to do and maintain.