Linux name resolution: /etc/resolv.conf

Name resolution means translating a string such as 'gateway.enterprise.net' into an IP address such as 194.72.194.1. When your machine is connected to the Internet, you need to be able to do this for addresses all over the world.

You do this through the Internet's Domain Name Service, which is a decentralised system for address translation. You will not usually run a nameserver yourself, unless you are managing extensive sub-networks. The nameserver is run by your ISP.

You have to tell your software where to find the name servers. This is done in /etc/resolv.conf, which looks like this:

domain lfix.co.uk
nameserver 194.72.192.1
nameserver 194.72.192.3
The domain is your own domain name, corresponding to the suffixes in /etc/hosts.

The nameservers are the primary and secondary nameservers of my ISP, Enterprise plc. The IP addresses are specified, rather than the names, because you would need a nameserver to translate the names to IP addresses.

If you try to use an address which is not in your local domain, the name resolver will ask the primary nameserver for its IP address. If that fails, it will try the secondary nameserver before giving up.

If PPP is not running, you will get the message "No route to host", meaning that there is no way to contact the nameserver.



Up to Linux PPP page

Last updated on 31st October 1996 by Oliver Elphick