# Name Resolution Issue, yet nslookup works [solved-properly]

## koan

Hello,

I recently changed the domain name of my local network, and one of the gentoo boxes no longer will resolve names.

Its resolv.conf looks like this:

```

search=domain.local

nameserver=10.1.1.2

nameserver=10.1.1.20

```

The /etc/hosts file has the canonical name first for localhost:

```

127.0.0.1 name.domain.local name localhost

```

/etc/hosts.conf says:

```

order hosts, bind

```

If I dig or nslookup google.com, I get the correct address.  However if I telnet or ping the same address, I get host unknown. Same for local addresses.  The broken gentoo box is in the 10.1.1.0/24 range, and gets its ip from dhcp (from either 10.1.1.2 or 10.1.1.20)

I can direct nslookup to either of the dns servers for resolution, and they both provide answers to queries.

So gethostbyname is failing, but it looks like everything it needs is in place.

Any tips on how to troubleshoot this?  Note that I did have resolvconf installed before, and uninstalled it to simlify things and to see if it was the source of the problem.

Thanks,

Paul[/code]Last edited by koan on Mon Jan 21, 2008 9:04 pm; edited 2 times in total

----------

## koan

I have just seen the bug in baselayout 1.12.11 - I am using sys-apps/baselayout-1.12.10-r5 (0)

And my routing table is:

```

$ netstat -rn 

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

10.1.1.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         10.1.1.2        0.0.0.0         UG        0 0          0 eth0

```

So, not a routing issue

----------

## Hu

Emerge dev-util/strace and use it to trace the failing resolution.  Look for any failed system calls.  If I had to guess, I would start with checking whether the permissions on /etc/resolv.conf allow it to be read by the user running telnet.

----------

## koan

Thanks Hu,

The problem was exhibited for root also.

Cheers for the strace tip, I noticed that the resolution sequence called to avahi.  I am not using avahi for anything, and once it was out of the picture, everything worked fine.

Paul

----------

## koan

Uh no.

Wrong.  Taking avahi out of the picture only solved things for "ping".  Most other things still could not resolve.

Turned out that libnss_dns.so.2 was missing.  A re-emerge of glibc rectified that...

----------

## qriff

This is directly related to the /etc/resolv.conf line: 

```
search domain.local
```

where setting a top-level domain of .local will fail.

Dont know why.

This also affects Sabayon.

----------

## yuhu

this is the answer

 *Quote:*   

> http://www.avahi.org/wiki/AvahiAndUnicastDotLocal

 

workaround: change in /etc/nsswitch.conf 

 *Quote:*   

> hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

 

to

 *Quote:*   

> hosts: files dns mdns4

 

this will solve not all problems, but for me it works

----------

