# wget name resolution fails, ping and other connections work.

## barfo

hi all.  so i was emerging world and after getting the latest udev i see an error about the x264 package:

```
>>> Emerging (1 of 1) media-libs/x264-0.0.20091021

>>> Downloading 'http://distfiles.gentoo.org/distfiles/x264-snapshot-20091021-2245.tar.bz2'

--2010-01-24 15:00:29--  http://distfiles.gentoo.org/distfiles/x264-snapshot-20091021-2245.tar.bz2

Resolving distfiles.gentoo.org... failed: Temporary failure in name resolution.

wget: unable to resolve host address `distfiles.gentoo.org'
```

so i scratched my head a bit and wondered...  then tried:

```
[ root@mrblack  3:18PM ]~$ ping distfiles.gentoo.org

PING distfiles.gentoo.org (149.20.20.135) 56(84) bytes of data.

64 bytes from mirrors1.kernel.org (149.20.20.135): icmp_seq=1 ttl=57 time=63.9 ms

64 bytes from mirrors1.kernel.org (149.20.20.135): icmp_seq=2 ttl=57 time=63.4 ms

^C

--- distfiles.gentoo.org ping statistics ---

4 packets transmitted, 4 received, 0% packet loss, time 3002ms

rtt min/avg/max/mdev = 62.930/63.451/63.927/0.353 ms

[ root@mrblack  3:20PM ]~$ 
```

now i try running wget again...

```
[ root@mrblack  3:20PM ]~$ wget http://distfiles.gentoo.org/distfiles/x264-snapshot-20091021-2245.tar.bz2

--2010-01-24 15:21:39--  http://distfiles.gentoo.org/distfiles/x264-snapshot-20091021-2245.tar.bz2

Resolving distfiles.gentoo.org... failed: Temporary failure in name resolution.

wget: unable to resolve host address `distfiles.gentoo.org'

[ root@mrblack  3:21PM ]~$ 
```

relevant info:

```
[ root@mrblack  3:21PM ]~$ cat /etc/resolv.conf 

# Generated by dhcpcd from eth0

# /etc/resolv.conf.head can replace this line

search pwhitt

nameserver 10.0.0.1

# /etc/resolv.conf.tail can replace this line

[ root@mrblack  3:22PM ]~$ 
```

where 10.0.0.1 is my router.  i re-ran /etc/init.d/net.eth0 and all is the same after seeing no errors.

obviously firefox and all are working.  i tried setting the nameserver in my resolv.conf from 10.0.0.1 directly to my ISP's nameserver addy and that didn't work - it actually broke ping, firefox et al.

so what does this mean???

thanks for any info!

--- edit ---

so after posting this i tried manually adding the IP addys for distfiles.gentoo.org and mirrors.gentoo.org to /etc/hosts and now wget works.  but if i remove those lines...  back to broken.

i should also point out that according to another similar problem i found elsewhere online i tried an `env-update` and `source etc/profile` with no changes observed.  i've restarted net.th0 several times now too...

----------

## truc

Just out of curiosity, could you use tcpdump, and see if there are dns queries when using wget?

----------

## barfo

well - it seems that for whatever reason i now have to use `wget -4` in order to force the use of ipv4.

i'm not sure when that borked or how it's related to my update yesterday...  but it would have been nice to see a message somewhere near the end of portage's error when the emerge ended.

i still haven't taken the entry out of my hosts file, but wget now works if i use -4.  i'll check it later.

----------

## d2_racing

Do you use iptables on your box ?

----------

## barfo

nope - no iptables.

it seems that at some point while updating, the default for wget went from ipv4 to ipv6.

i haven't tried it yet, but i suspect that by adding an entry to define FETCHCOMMAND as wget with the -4 argument, it'll work.

I'll check it out this evening and will post the results...

----------

## guldan

Could this help, wget might behave the same way as ssh ?

https://forums.gentoo.org/viewtopic-t-810843-highlight-nameserver+resolve+conf.html

----------

