Disable IPv6 on Ubuntu 18.04 or later with GRUB

If IPv6 is causing issues with DNS, such as leaking over your VPN, simply disable it in your kernel on boot.  Open up the grub config file:

sudo vi /etc/default/grub

 

Add the parameters:

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

 

Save your changes and run:

sudo update-grub

 

Restart your machine and go to ipleak.net to confirm you no longer have an IPv6 address.