I'm running into a very weird issue on my Ubuntu server 12.04.3 LTS system. It's been set up to also use IPv6 (2001:xxx:yyy:1::12). When using wget to connect to an IPv4-only host the following happens:
Instead of finding *no* IPv6 address for www.newznab.com, wget DNS resolution finds my *own* IPv6 address first, and the correct IPv4 address second. It then tries to connect to the first address found, which is completely wrong of course. Can anyone shed some light on why this would be happening?
--2013-12-04 21:22:31-- http://www.newznab.com/
Resolving www.newznab.com (www.newznab.com)... 2001:xxx:yyy:1::12, 18.104.22.168
Connecting to www.newznab.com (www.newznab.com)|2001:xxx:yyy:1::12|:80...
I am running my own nameserver, which afaik is set up correctly. Doing the above name resolution using 'host' doesn't show this strange behaviour:
As a work-around I've edited /etc/gai.conf to prefer IPv4, which ensures wget finds the correct address first. But it still finds the wrong address second, which shouldn't be the case imo.
www.newznab.com has address 22.214.171.124
Thanks for any insights,