Yum error connecting IPv6 address

A simple yum update command fails. The scary thing is the error message which tells it’s impossible to connect to an IPv6 address:

# yum update
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
Error: Cannot find a valid baseurl for repo: base

The suspicious aspect is that I have no IPv6 connectivity, and despite this other machines run yum happily. So I would like yum to use the old and beloved IPv4 even on this machine (which actually does, as we will see). But first things first. Around the internet there are several advices to disable IPv6, and various tips about how to do it. All these suggestions led to no solution. The truth that emerges is that Yum resolves the host name to contact via DNS, and upon getting both A and AAAA records, it tries to contact first the A records, then in case of failure it uses the AAAAs. The bizarre thing is that if all attenpts fail, Yum only reports the last error, which will easily be of IPv6 type. That’s why the error is on IPv6. In the end, ignoring the misleading Yum message and invoking a healthier tcpdump, my specific problem has proven much more mundane, firewall rule that was preventing this host to contact any host on the Internet, no matter if it was IPv4 or IPv6.

Comments are closed.