I have a Ubuntu machine that has access to the internet but fails to resolve hostnames.
I tried to edit /etc/resolv.conf
like suggested in various places. But I can't display its contents or edit it permanently.
The interface config
My Network config at /etc/network/interfaces
looks like so:
# This file describes the network interfaces available on your
# system and how to activate them. For more information, see
# interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 46.101.158.60
netmask 255.255.192.0
gateway 46.101.128.1
dns-nameservers 8.8.8.8 8.8.4.4
Nameservers
So I do have a dns record and it points to 8.8.8.8
and 8.8.4.4
respectively.
I can ping these two:
# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=124 time=0.965 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=124 time=0.538 ms
# ping 8.8.4.4
PING 8.8.4.4 (8.8.4.4) 56(84) bytes of data.
64 bytes from 8.8.4.4: icmp_seq=1 ttl=61 time=0.977 ms
Details
$ uname -a
Linux XYXY 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:28:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Resolv.conf
The file is there in /etc
.
# ls -lia /etc/resolv.conf
655492 lrwxrwxrwx 1 root root 29 Jul 5 15:29 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
However I can't show the contents of it.
# cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
Additionally I can't change the file:
# echo "nameserver 8.8.8.8" > /etc/resolv.conf
-bash: /etc/resolv.conf: No such file or directory
Workaround
As an initial workaround I did add some hosts in /etc/hosts
but this gets very tedious once I need more domains.
Internal Reference VS#284
/etc/resolv.conf
correspond to the entry in/etc/network/interfaces
?/etc/resolv.conf
not being present at any Linux system - it will be regenerated, but never completely removed. @Besi did you restart thenetworking
service?resolv.conf