I was putting the following in /etc/sysctl.conf in Ubuntu 16.04 and ipv6 was disabled.

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

In Ubuntu 18.04 I have to add the following to grub.


Just wanted to have confirmation whether this is the new way in Ubuntu 18.04 to disable IPv6.

  • why do you want to disable IPv6? That's considered bad practice. – TJJ Oct 19 at 18:38

You only need to add this to /etc/default/grub


I also did it on GRUB_CMDLINE_LINUX_DEFAULT to be safe. Modifying sysctl only partially worked, and noticed the bug show-up in netplan, I even tried dhcp6=false to no avail. Netplan seems to have too many bugs for 18.04 STABLE IMO but that's another story...half tempted to remove netplan also.

Just don't forget to update grub before rebooting!

sudo update-grub
  • 1
    Can you clarify how this answers the question? I am confused by your answer. – Stephen Rauch Jun 13 '18 at 3:19
  • 1
    Please consider reporting the netplan bugs you found on launchpad.net! It will help the developers making it better. – Sebastian Stark Jun 13 '18 at 5:11
  • Sebastian Stark - I will try to get to it, it just does not seem to pay attention to kernel settings hence why the grub command was needed, everything else used sysctl.conf except netplan. – VTChevalier Jun 14 '18 at 19:21

To clarify Stephan Rauch (for 18.04 only) - If using grub method to disable ipv6, the /etc/sysctl.conf configuration changes were not needed. I ended up leaving them in, (in case netplan is fixed in future) but all that is needed is the following:

sudo vi /etc/default/grub

Modify the GRUB_CMDLINEs to look like:


Then execute:

sudo update-grub
sudo reboot

Enjoy ipv4.

  • Thanks for the info. Do we think this would be worthy of a netplan bug or is configuring things like this through sysctl.conf deprecated anyway? I couldn't find a relevant bug in bugs.launchpad.net/netplan but perhaps I missed it? – sxc731 Dec 25 '18 at 12:03

Let sed do the work :D

sudo sed -i -e 's/GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity"/GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 maybe-ubiquity"/' /etc/default/grub
sudo sed -i -e 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="ipv6.disable=1"/' /etc/default/grub
sudo update-grub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.