Fix
Could not resolve host, but the IP address works
The machine has no working DNS server: /etc/resolv.conf is empty or names a server that does not answer. Put a reachable resolver in it.
Likely causes
- No
nameserverline in/etc/resolv.conf. - A
nameserverthat is down, unreachable, or refuses your network.
Diagnose
Run these in order. The output is what each printed on a lab's real Linux machines.
-
leo:~# curl -sS -m 5 http://zoe.lab/ - The name fails:
Could not resolve host. curl never tried to connect.curl: (6) Could not resolve host: zoe.lab
-
leo:~# ping -c 1 10.0.2.10 - The same server by address answers, so the network is fine and only names are broken.
PING 10.0.2.10 (10.0.2.10) 56(84) bytes of data. 64 bytes from 10.0.2.10: icmp_seq=1 ttl=63 time=0.103 ms --- 10.0.2.10 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.103/0.103/0.103/0.000 ms
Fix
-
/etc/resolv.conf - One line names the DNS server: here the router,
10.0.1.2.nameserver 10.0.1.2
-
leo:~# curl -sS -m 5 http://zoe.lab/ - The page loads by name.
Zoe's studio is open until six
Break it and fix it yourself
Each lab is a small network of real Linux machines in your browser, where this fault happens.
- Linux networking: bring a blank machine online by hand
- OSI model: read the layers on a real packet : its challenge "Names stopped working" set the fault for you to find and fix.