Disabling IPv6 in Ubuntu Server 18.04

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:

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"

Then execute:

sudo update-grub
sudo reboot

Enjoy ipv4.


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

GRUB_CMDLINE_LINUX="ipv6.disable=1"

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

Tags:

Server

18.04