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 or passed on; it is used for the confirmation link and to recognise your later comments, and is deleted when you have no comments left here. Comments that are never confirmed are deleted after 7 days. Confirming sets a cookie in this browser so that it does not ask again.