apt force IPv4

One of my internet provider only provide IPv4 connection. When i run apt install command, it failed with error as it try to connect using IPv6.

boby@sok-01:~$ sudo apt install php7.3-curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  php7.3-curl
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 29.6 kB of archives.
After this operation, 123 kB of additional disk space will be used.
Err:1 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.3-curl amd64 7.3.13-1+ubuntu18.04.1+deb.sury.org+1
  Could not connect to ppa.launchpad.net:80 (2001:67c:1560:8008::15). - connect (101: Network is unreachable) Could not connect to ppa.launchpad.net:80 (91.189.95.83), connection timed out
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.3/php7.3-curl_7.3.13-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb  Could not connect to ppa.launchpad.net:80 (2001:67c:1560:8008::15). - connect (101: Network is unreachable) Could not connect to ppa.launchpad.net:80 (91.189.95.83), connection timed out
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
boby@sok-01:~$

To force apt to use IPv4 only, edit

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

Add

Acquire::ForceIPv4 "true";

If you want to force IPv6, add

Acquire::ForceIPv6 "true";
Need help with Linux Server or WordPress? We can help!

Leave a Reply

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