Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Gateway 192.168.122.1 runs dns, and the command dig @192.168.122.1 www.google.com returns valid ip addresses, so dns is working and reachable.

The command tracepath www.google.com returns gethostbyname2: Host name lookup failure.

The command tracepath 74.125.129.103 (www.google.com) yields valid results, so the default route is set up correctly.

The command route -n outputs:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.122.1   0.0.0.0         UG    100    0        0 eth0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

And the applicable portion of /etc/network/interfaces reads:

auto eth0
iface eth0 inet static
    address 192.168.122.5
    netmask 255.255.255.0
    broadcast 192.168.122.255
    gateway 192.168.122.1
    dns-servers 192.168.122.1

No firewalls are currently running.

I would think, given these settings, that tracepath www.google.com would contact 192.168.122.1 for dns information, which is verified to be working and reachable.

What should I do next to find out why the tracepath command returns gethostbyname2: Host name lookup failure?


Edit (more info)

/etc/resolv.conf is empty. Ubuntu 12.04 uses a new subsystem, resolvconf, that autogenerates resolv.conf data in /etc/resolvconf/resolv.conf.d/*.

/etc/resolvconf/resolv.conf.d/original contains:

nameserver 192.168.122.1

All other resolv.conf.d files (head and base)are empty.

/etc/nsswitch.conf contains:

    passwd:         compat
    group:          compat
    shadow:         compat

    hosts:          files dns
    networks:       files

    protocols:      db files
    services:       db files
    ethers:         db files
    rpc:            db files

    netgroup:       nis

/etc/hosts contains:

    127.0.0.1       localhost
    127.0.1.1       hostname

    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
share|improve this question
1  
What's in your /etc/resolv.conf and /etc/nsswitch.conf for hosts:? –  Ladadadada Mar 4 '13 at 22:41
    
The info is added to the question. –  David Mar 4 '13 at 23:18
1  
What nameserver do your lookups come from if you remove the @192.168.122.1 from your dig? The next step will be to tcpdump -n port 53 while doing the above failing commands. –  Ladadadada Mar 5 '13 at 7:29
    
A nameserver was not being contacted. That was the really weird thing to me. The problem is now solved. Thanks! –  David Mar 5 '13 at 19:06

2 Answers 2

up vote 1 down vote accepted

I'm not very familiar with the resolv.conf.d version, but I believe you should put the lookup settings in /etc/resolv/resolv.conf.d/base instead of /etc/resolv/resolv.conf.d/original

share|improve this answer
    
That did it! And it lead me to another answer, which I'll post in addition. Thanks! –  David Mar 5 '13 at 18:55

The accepted answer, where the nameserver directive goes in the /etc/resolv/resolv.conf.d/base file is one way of managing the nameserver setting in ubuntu's new resolvconf subsystem, but there is also another way, which I had been attempting with my config.

Nameservers can also be set in the /etc/network/interfaces file using the dns-nameservers directive.

My problem was a typo! I had written dns-nameservers as "dns-servers".

I've verified both the accepted answer and this answer to work.

share|improve this answer
    
Thanks for writing this, it'll be useful when we do our next upgrade here! –  Jenny D Mar 6 '13 at 7:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.