Recently I came into a situation where all of my virtual machines were failing to reach the WAN. After some troubleshooting, I discovered that, for whatever reason, an update to the router on my network was causing the failure. The issue stemmed from an improperly configured IPv6 issue in the firmware of the networking hardware. But what was I to do? Wait for the provider to send out an update to fix the issue? No. Instead, I disabled IPv6 in my virtual machines. Otherwise, they’d be non-functional until the provider pushed an update, which, knowing the provider, could take far too much time. However, I had various Linux distributions as virtual machines, which meant I had to take care of each VM using a different method.
Disabling IPv6 in Linux isn’t terribly challenging. There are a number of ways to do this in Linux. One way is in Red Hat-based systems, using the sysctl command. Another way can be found in Debian-based systems, by editing the /etc/sysctl.conf file (see How to disable IPv6 on Linux for more information on these two methods).
However, I found a more reliable method that works on all Linux distributions that use the GRUB bootloader. This method requires sudo access, the editing of a file, and the running of a command, but it’s worth learning should you find yourself in a similar situation, and you run a variety of Linux distributions.
SEE: Configuration management policy (Tech Pro Research)
Editing the GRUB file
The file in question is /etc/default/grub. Open that file in your favorite text editor (such as with the command sudo nano /etc/default/grub). Within that file, you’ll see two lines:
You might find that the first line looks like:
The quiet splash entry silences all kinds of information from displaying on the screen at boot.
Edit the above lines to reflect the following:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"
Save and close that file.
Now we must update the GRUB bootloader, otherwise the system will not notice the changes. Go back to the terminal window and issue the following command:
Once that command completes, reboot your machine (or virtual machine), and IPv6 will be disabled during the boot process. If you were having networking issues, due to ill-configured IPv6 on a router, your Linux machine should no longer have any problems reaching the WAN.
A fix that shouldn’t be needed
This type of fix shouldn’t be needed. Unfortunately, some providers haven’t figured out how to configure IPv6 so that it won’t cause problems with certain operating systems. If you fall into that category, you might find the only solution is disabling IPv6, until said provider pushes an update that fixes the problem they created. Once IPv6 is operational, you can simply reverse this process (removing the ipv6.disable=1 entries), rerunning sudo update-grub, and rebooting.