How To Disable IPv6 for APT in Ubuntu 18.04 and above

Ubuntu by default tries to connect to ipv6 address for apt update. This is not a problem as after the ipv6 connection fails it will try ipv4.

If your network does not have ipv6 connectivity the time it takes to fall back from ipv6 to ipv4 everytime you run updates is annoying.

Disable IPv6 only for APT

If you disable ipv6 only in APT other programs will continue to use ipv6. Follow the below steps to disable ipv6 only for APT by adding to the APT configuration.

First create a file in apt config directory

sudo nano /etc/apt/apt.conf.d/99force-ipv4

Add the below line to the file and save it

Acquire::ForceIPv4 “true”;

After adding the above configuration APT will only use IPv4 for connecting to the internet.

Leave a Reply

Your email address will not be published. Required fields are marked *