# Odd DNS resolution issues

## rcxAsh

I haven't used my Linux system in a while, and it has always been working fine until recently when I last booted into it, I'm having a really odd issue with my network connection.  

Essentially, I can ping any domain (e.g. google.com) and the name is resolved and I get ICMP responses.  

But if I try to load up any other software such as wget, or Firefox, they fail to resolve anything.  What I can do, of course, is pull the IP address that I see from the output of ping and use that to connect to the servers, but this is hardly a solution.  

I'm not sure what's gone wrong.  Any thoughts would be appreciated!

----------

## 1clue

Please show us the contents of /etc/resolv.conf and ifconfig and netstat -rn

----------

## rcxAsh

Here's what I see:

```

cha ~ # cat /etc/resolv.conf

# Generated by NetworkManager

nameserver 192.168.1.254

```

```

cha ~ # ifconfig

eth0      Link encap:Ethernet  HWaddr 00:11:09:c9:a3:c9

          inet addr:192.168.12.103  Bcast:192.168.12.255  Mask:255.255.255.0

          inet6 addr: fe80::211:9ff:fec9:a3c9/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:2383 errors:0 dropped:0 overruns:0 frame:0

          TX packets:470 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:246672 (240.8 KiB)  TX bytes:43687 (42.6 KiB)

          Interrupt:16

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

```

```

cha ~ # netstat -rn

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

192.168.12.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0

127.0.0.0       0.0.0.0         255.0.0.0       U         0 0          0 lo

0.0.0.0         192.168.12.1    0.0.0.0         UG        0 0          0 eth0

cha ~ #

```

The DNS server of 192.168.1.254 is my DSL modem, which my router hangs off of.  My Windows laptop uses the same DNS server.  

Again the strange thing is that DNS resolution is working on my Linux box - but only for PING.  Other applications are not resolving anything!

Consider this output, which was run one after the other:

```

ashley@cha ~ $ ping -c 2 google.com

PING google.com (74.125.95.104) 56(84) bytes of data.

64 bytes from iw-in-f104.1e100.net (74.125.95.104): icmp_seq=1 ttl=49 time=26.6 ms

64 bytes from iw-in-f104.1e100.net (74.125.95.104): icmp_seq=2 ttl=49 time=26.3 ms

--- google.com ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1000ms

rtt min/avg/max/mdev = 26.374/26.534/26.694/0.160 ms

ashley@cha ~ $ wget google.com

--2010-11-21 13:34:22--  http://google.com/

Resolving google.com... failed: Temporary failure in name resolution.

wget: unable to resolve host address `google.com'

ashley@cha ~ $

```

----------

## Hu

What if you do wget -4 instead of just wget?

----------

## rcxAsh

That seemed to work!  So I somehow my system is trying to use IPv6?  I do notice in my /var/log/messages that there is a line saying "kernel: eth0: no IPv6 routes present" when I start the network service.  

Should I disable IPv6 for the time being?  I'm not so sure why I'm experiencing this now - unless it's on my ISP or new DSL modem side of things?

----------

## Hu

Some braindead DSL modems are known to cause problems when using IPv6.  Most likely, your modem's built in DNS server misbehaves when asked for an IPv6 AAAA record.  You can use ping because it only ever requests IPv4 A records.  Disabling IPv6 should work around the problem for now, but you may want to look into finding a properly behaved DNS server, too.

----------

## rcxAsh

Thanks for the help.  Things are working for now with IPv6 disabled.  I might have to see if I can configure my modem differently, to maybe let my router handle everything instead.

----------

## lyallp

I find my ADSL modem, very occasionally, gets it's knickers in a twist with regards to DNS.

I re-boot the modem and things return to normal.

----------

## Logicien

Sorry,

but I do not understand how you can join a local DNS server 192.168.1.254 with no local route that allow you to do so. You have two configured networks, 192.168.12.0/24 and 127.0.0.0/8 but not 192.168.1.0/24. If your local network is configured by DHCP something is wrong. Can you

```
ping -c 4 192.168.1.254
```

A workaround I think would be to put reals Internet DNS servers like the ones of your ISP or Open DNS in /etc/resolv.conf or reconfigure the network and/or the router.

----------

## rcxAsh

 *Logicien wrote:*   

> Sorry,
> 
> but I do not understand how you can join a local DNS server 192.168.1.254 with no local route that allow you to do so. You have two configured networks, 192.168.12.0/24 and 127.0.0.0/8 but not 192.168.1.0/24. If your local network is configured by DHCP something is wrong. Can you
> 
> ```
> ...

 

In my setup, the modem connects to the internet and assigns an internal network IP address to my router.  This is in the 192.168.1.*** range.  My computers then connect to my router, which assigns addresses to them in the 192.168.12.*** range.  Since the computers are behind the router, then can reach out to the modem, and subsequently the internet.  It's like there are two layers of NAT that I have - one on the modem, and then one on my router.  (Although the modem only has one RJ45 connector on it).  

I have things working now as per the IPv6 comments as pointed out by Hu.  I'd like to keep DHCP as the main method for assigning my addresses, so I'll probably let NetworkManager or dhcpcd work out the resolv.conf file for itself for the time being.  Thanks for the tip though!

----------

## Hu

When using dhcpcd, you can selectively override parts of the DHCP configuration.  This would allow you to use DHCP for most things, but still force a DNS server of your choosing.  You could also look at the documentation for your router to see if you can tell it to offer a different set of DNS servers.

----------

## truc

Sorry to jump in here like that, but I have a question for the OP: 

if you do this:

```
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
```

does it really disable IPv6 for you? (ie: does wget http://google.com work? without -4, I mean)

----------

## rcxAsh

I've rebuilt wget without ipv6 and also disabled ipv6 at the kernel module level, so I will have to put it back in to try for you.  Might not be this week though as I'm going to be away, but I'll see if I can give it a try next week!

----------

## truc

wow, thanks rcxAsh, this is just out of curiosity, so I feel bad if you go in that much trouble for me :S

I was actually asking this, because I'me not sure what this sysctl settings really does and how applications/services change their behaviour accordingly. Some of them seem to try some IPv6 things anyway, which I found weird?!

----------

## rcxAsh

Hey again, sorry it took a while to reply, I was rebuilding my system.  

At any rate, putting back IPv6, I then tried the command:

```
sysctl -w net.ipv6.conf.all.disable_ipv6=1
```

But wget still required the -4 option to resolve things.  All other applications that seemed to be failing to resolve due to my modem not properly supporting IPv6 were not working either.  

Is this behaviour unexpected?

----------

## truc

 *rcxAsh wrote:*   

> Is this behaviour unexpected?

 

Ok, same here. I'm no kernel expert but I thought disabling ipv6 would prevent applications from trying it.

This is kinda weird, isn't it?

Thanks rcxAsh!

----------

## rahulthewall

 *truc wrote:*   

>  *rcxAsh wrote:*   Is this behaviour unexpected? 
> 
> Ok, same here. I'm no kernel expert but I thought disabling ipv6 would prevent applications from trying it.
> 
> This is kinda weird, isn't it?
> ...

 

Had the same problem with DNS and IPv6. I blacklisted IPv6 (and the module was not loaded) but the DNS issues persisted. The only solution was to build everything with USE="-ipv6".

----------

## rcxAsh

That is kind of strange!  At least we know we're not going crazy  :Razz:   It seems like it would have been good or expected that if IPv6 routes failed, that it could at least try to fall back to IPv4.  

At any rate, my longer term fix has been to manually enter the DNS servers into my router that the modem gets from my ISP rather than letting the router hand off the DNS serving to the modem which seems a bit buggy that way.  That way I've been able to re-enable IPv6.  

Thanks for all the tips, everyone.

----------

