6

I am aware of the grub kernel params method but I'd like to understand why the sysctl approach is not working.

On a 20.04 server if I add net.ipv6.conf.(all|default|lo).disable_ipv6=1 (presumably ".all." should be enough), to /etc/sysctl.conf (or a separate /etc/sysctl.d/ file), on boot it only disables ipv6 on the loopback, the main interface still has it.

Since it works for loopback, the sysctl conf files are being processed on boot.

stackblow
  • 570

2 Answers2

2

systemd-networkd will reset the disable_ipv6 sysctl to false during network device configuration if it believes ipv6 should be enabled.

On Ubuntu 22.10, I had to edit the /etc/netplan/configname.yaml file (reference) and add:

link-local: [ ]

under my network devices to avoid the ipv6 link-local address creation that caused this.

0

Sadly, there are many myths about how to disable IPv6 on Ubuntu and the Ubuntu project itself hasn't provided a canonical solution going as far back as Ubuntu 16.04.

The best solution that I've found so far is to modify the Kernel commandline via Grub and reboot the system. See here:

https://askubuntu.com/a/337736/266