This question already has an answer here:
- How to disable IPv6 permanently? 5 answers
I'm trying to disable IPv6 on all of the adapters on an Ubuntu 17.10 machine. I used to be able to do so (prior Ubuntu versions) by editing /etc/sysctl.d/99-sysctl.conf to add disable parameters as follows:
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.d/99-sysctl.conf echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.d/99-sysctl.conf echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.d/99-sysctl.conf
then reloading the parameters with:
With Ubuntu 17.10, this works for the current session (i.e.,
ip address will show only IPv4 addresses), but IPv6 addresses come back after a reboot. (FWIW, I also have
dhcp6: no set for each adapter in the netplan 01-netcfg.yaml file, so the IPv6 address associated with each adapter is a default one.)
How do I disable IPv6 permanently on an Ubuntu 17.10 (netplan) machine?
Since this was marked as an "exact duplicate" of https://askubuntu.com/a/337736/283721, I'll defend my question by noting that
That answer, which I had seen, appears to be a last resort ("If your PC doesn't load /etc/sysctl.conf at boot time"). I think Ubuntu 17.10 does load
/etc/sysctl.d/99-sysctl.confat startup (though I'll do some research to confirm this if no one who knows responds to this), and
There has to be a more elegant (or "correct") way to disable IPv6 within Ubuntu. I can think of lots of kludgy ways to disable IPv6 (cron script run at boot, this grub fix, etc.), but I'm worried about portability across, for example, kernel updates (will my grub edits persist across updates, or will I need to make the same edits each time?).
Since this problem appears to have started only with the move to netplan instead of
/etc/network/interfaces, I'm hoping someone familiar with netplan network configuration will weigh in.
Sorry if I sound defensive, but I try very hard to do my homework first and not to post duplicate questions.