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
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
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 newresolvconf
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 thedns-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.