These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX01/Name Resolver

Classnotes | UNIX01 | RecentChanges | Preferences

Configuring your Name Resolver

The `Name Resolver' is a part of the linux standard library. Its prime function is to provide a service to convert human-friendly hostnames (like `einstein.physics.arizona.edu' ) into machine friendly IP addresses (such as 128.196.189.62).

What information you will need

You will need to know what domain your hosts name will belong to. The name resolver software provides this name translation service by making requests to a `Domain Name Server'. You will need to know the IP address of a local name server that you can use.

There are three files you need to edit. I'll cover each of these in turn.

/etc/resolv.conf

The /etc/resolv.conf is the main configuration file for the name resolver code. Its format is quite simple. It is a text file that has one keyword per line. There are three keywords typically used by the file. These keywords are:

  • domain
    • This keyword specifies the local domain name.
  • search
    • This keyword specifies a list of alternate domain names to search for a hostname
  • name server
    • This keyword, which may be used many times, specifies an IP address of a domain name server to query when resolving names

An example /etc/resolv.conf might look something like:

   domain maths.wu.edu.au
   search maths.wu.edu.au wu.edu.au
   name server 192.168.10.1
   name server 192.168.12.1

This example specifies that the default domain name to append to unqualified names (ie hostnames supplied without a domain) is maths.wu.edu.au . If the host is not found in that domain, it will also try the wu.edu.au domain directly. Two name server entries are supplied. These entries may be called upon by the name resolver code to resolve the name.

/etc/host.conf

The /etc/host.conf file is where you configure some items that govern the behavior of the name resolver code. The format of this file is described in detail in the `resolv+' man page. In nearly all circumstances, the following example will work for you:

  order hosts,bind
  multi on

This configuration tells the name resolver to check the /etc/hosts file before attempting to query a name server. It also tells the resolver to return all valid addresses for a host found in the /etc/hosts file (instead of just the first address).

/etc/hosts

The /etc/hosts file is where you put the name and IP address of local hosts. If you place a host in this file, then you do not need to query the domain name server to get its IP Address. The disadvantage of doing this is that if the IP address for that host changes, you must keep this file up to date yourself . In a well managed system, the only hostnames that usually appear in this file are an entry for the loopback interface, and also the local hosts name.

 # /etc/hosts
 127.0.0.1      localhost loopback
 192.168.0.1    this.host.name

You may specify more than one host name per line (as demonstrated by the first entry), which is a standard entry for the loopback interface.

Running a name server

If you want to run a local name server, you can do it easily. Please refer to the DNS HOWTOs (http://tldp.org/HOWTO/HOWTO-INDEX/networking.html#NETDNS) and to any documents included in your version of BIND (Berkeley Internet Name Domain).



Classnotes | UNIX01 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited August 1, 2003 4:33 am (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.