# Make ipv4 addresses (A rec) default when resolving

## selig

I have just set up an ipv6 router.

This is my problem:

```

>>> Emerging (1 of 18) x11-proto/xproto-7.0.21

>>> Downloading 'ftp://gentoo.mirror.dkm.cz/pub/gentoo/distfiles/xproto-7.0.21.tar.bz2'

--2011-06-11 19:52:11--  ftp://gentoo.mirror.dkm.cz/pub/gentoo/distfiles/xproto-7.0.21.tar.bz2

           => `/var/tmp/Distfiles/xproto-7.0.21.tar.bz2'

Resolving gentoo.mirror.dkm.cz... 2001:470:1f0b:13d2::49, 86.49.49.49

Connecting to gentoo.mirror.dkm.cz|2001:470:1f0b:13d2::49|:21...

```

This is my ISP's mirror. Apparently, they set up an AAAA record for gentoo.mirror.dkm.cz but the IP address 2001:470:1f0b:13d2::49 is unreachable (or so it seems). I cannot even ping it - however, my IPv6 setup is fine, I can access IPv6 servers without a problem.

I would like the system to prefer IPv4 addresses if both are returned from the DNS query. Is this possible?

----------

## gentoo_ram

You can't really "fix" the DNS query.  Instead, maybe the best option is to set the fetch options in /etc/make.conf to include the "-4" flag to wget.  Not sure how to do that, but that's approach I would take.

----------

## wswartzendruber

The preferred record type is up to the client, not the server.

----------

## selig

So does it need to be specified for every client (if it has such an option) or is there also a system-wide setting?

----------

## new_item

 *selig wrote:*   

> So does it need to be specified for every client (if it has such an option) or is there also a system-wide setting?

 

I am kind of a n00b when it comes to IPv6. But did you try to add IPv4 record in /etc/hosts ? AFAIK it is searched before dns query, so it might work.

It could be solution for limited amount of domains.

----------

## Veldrin

well plan B would be to remove ipv6 altogether (i.e. in kernel)

a slightly less drastic option is to disable ipv6 protocol wise (edit /etc/modprobe.d/aliases.conf, and enable alias net-pf-10 off). This only works,  if ipv6 is built as a module (and not built in).

just my .02$

V.

----------

## selig

So I take it that it is impossible. I have just set up IPv6 because I want it so I am definitely not going to disable it.  :Wink:  As a workaround I have put the mirror's IPv4 address into make.conf instead of its hostname and this works (at least until they change the IP address). I just hope that there are not many such sites with broken IPv6...

----------

## mefyl

I know I'm exhuming a one year old thread, but I had the same problem and came up with (what I think is) a better solution, so it might help anyone with this issue. Since the problem is rsync choosing the ipv6 address, on can simply force it to prefer the ipv4 version by passing it -4. This can be done with the PORTAGE_RSYNC_EXTRA_OPTS option. So, in /etc/make.conf (or /etc/portage/make.conf nowadays):

```
PORTAGE_RSYNC_EXTRA_OPTS="-4"
```

No need to hardcode an IP in your host file this way.

Cheers,

----------

## rkfsm

I know.... this is an ancient thread but this issue is plaguing me. I cannot emerge mirrorselect because I cannot download stuff. Is there a way to disable ipv6 with wget so that emerge can properly download packages?

Russ

----------

## mike155

 *Quote:*   

> Is there a way to disable ipv6 with wget so that emerge can properly download packages?
> 
> 

 Do you need / want IPv6 at all? If not: disable it.

Look at the sections below of 'man wget':

--prefer-family

--inet4-only

/etc/wgetrc

.wgetrc

==> You could add 'prefer-family = IPv4' or 'inet4-only = yes' to /etc/wgetrc.

----------

## Ant P.

Dead mirrors should be reported as bugs, btw.

----------

## krinn

 *Ant P. wrote:*   

> Dead mirrors should be reported as bugs, btw.

 

not the case there

```
Resolving gentoo.mirror.dkm.cz... 2001:470:1f0b:13d2::49, 86.49.49.49 
```

```
ping -c1 -4 gentoo.mirror.dkm.cz

PING mirror.dkm.cz (86.49.49.49) 56(84) bytes of data.

64 bytes from mirror.dkm.cz (86.49.49.49): icmp_seq=1 ttl=48 time=67.5 ms

```

i don't have ipv6 to tell if the server ipv6 config is at fault or user one.

----------

