Skip to content
NetworkTechGuy

Force Apt-Get to use IPv4 or IPv6 on Ubuntu or Debian

By Nenad Karlovcec1 min read

Recently I transitioned my home network to dual-stack IPv4 / IPv6 and I noticed a strange issue on a number of my Debian-running servers: some of the apt updates were unable to complete. The issue seems to be lying in some of my (official) Debian sources being un-accessible via IPv6.

To resolve this, I edited a file:

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

I added the following line:

Bash
Acquire::ForceIPv4 "true";

After that I ran an apt update:

Bash
sudo apt update && sudo apt -y upgrade

This resolved my issue with IPv6 and Debian apt sources.

Comments (0)

No comments yet. Be the first to comment.

Leave a comment

Never shown. A confirmation link is sent to it.

Plain text. A comment with more than one link waits for review.

Privacy: your name and comment are shown once published. Your e-mail address is never shown to other visitors; it is used for the confirmation link and to recognise your later comments. It is stored encrypted and kept for as long as one of your comments is on this site (an address a moderator marked as trusted or blocked is kept with that mark). Comments that are never confirmed are deleted after 7 days. Confirming sets a cookie in this browser, for one year, so that it does not ask again. Details in the privacy policy.