
Here on Vultr, we have the option to enable IPv6 on all deployable VPSes. But with this, some programs and commands may prefer one or the other with unpredictable results.
In this guide, we will configure apt-get to use only IPv4 or IPv6. This guide targets Ubuntu 14.04 and Debian Jessie, but may work for newer versions as well.
If you want to force the apt-get to use IPv4 or IPv6 only one time, follow these steps. This feature is available after the 0.9.7.9~exp1 version of apt-get. First, make sure your version of apt-get is newer than 0.9.7.9~exp1 by running the following command:
The result will be something like this:
If the version checks out, then you can force IPv4 with:
or IPv6:
This will update the repositories resolving the URLs in sources.list to IPv4 only.
To make the setting persistent, create the file 99force-ipv4 in /etc/apt/apt.conf.d/.
Put the following contents in it:
Save the file, and you're good to go. If you want to force IPv6 instead, change the 4 to 6 in the file name and settings. To choose between one of them, test with the fast method and see which works better.
0 Comments
Be the first to comment and share your perspective with the community.