CentOS7 Yum using IPv6 and failing

Yum insists on using IPv6 despite there being no good reason to - and no IPv6 address on interfaces.

Getting an error like this?

[root@thisamyourserver ~]# yum -y update

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed to connect to 2001:4178:5:200::10: Network is unreachable"

 One of the configured repositories failed (Unknown),

 and yum doesn't have enough cached data to continue. At this point the only

safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working

        upstream. This is most often useful if you are using a newer

        distribution release than is supported by the repository (and the

        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then

        just ignore the repository until you permanently enable it again or use

        --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>

     4. Configure the failing repository to be skipped, if it is unavailable.

        Note that yum will try to contact the repo. when it runs most commands,

        so will have to try and fail each time (and thus. yum will be be much

        slower). If it is a very temporary problem though, this is often a nice

        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

[root@ thisamyourserver~]# ip addr show eno1
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:25:64:aa:bb:cc brd ff:ff:ff:ff:ff:ff
    inet 217.123.123.123/29 brd 217.123.123.121 scope global eno1
       valid_lft forever preferred_lft forever
As you can see here it is complaining about an IPv6 address - and this is an odd choice given the lack of IPv6 address, and having gone through the steps to disable IPv6 and having rebooted.

At this point, I am pulling at my already greyed hair. A lot.

So what is happening here?

Well, the IPv6 address is a red herring basically. It is not telling you what the problem is - just confirming that it indeed cannot get to where it wants to be.

What is occurring is an inability to get out of port 80 to the server in question. It is failing over IPv4, and then falling back to trying over IPv6. Which... no surprises fails.The error while technically correct is steering you in the wrong direction.

Changing the upstream (YES, I had checked local iptables and ip6tables) firewall for allowing more than ping et al - and suddenly - update action!

[root@thisamyourserver ~]# yum -y update

base | 3.6 kB  00:00:00

extras   | 3.4 kB  00:00:00

updates | 3.4 kB  00:00:00

(1/4): base/7/x86_64/group_gz | 156 kB  00:00:00

(2/4): extras/7/x86_64/primary_db | 166 kB  00:00:00

(3/4): base/7/x86_64/primary_db | 5.7 MB  00:00:00 

(4/4): updates/7/x86_64/primary_db 54% [==================-  ] 777 kB/s | 6.5 MB 00:00:07

 

Has the kettle boiled yet? Nice one... we are done here. No doubt I will forget next time too : )

One Response to “CentOS7 Yum using IPv6 and failing

Leave a Reply

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

%d bloggers like this: