31.2 Name Resolution Methods

   

31.2 Name Resolution Methods

There are multiple methods used to resolve a host name to its IP address. The simplest of these is using the /etc/ hosts file. This method is used for networks having a small number of hosts. This file contains the host names and IP addresses of all hosts on the network. A copy of the file is maintained on each host on the network. When the network grows in size , it becomes practically impossible to maintain consistency of this file on each host. In such a case, you have to use some other name resolution service. More popular services are NIS, NIS+, and DNS. NIS is discussed in more detail in the next chapter. A brief introduction to /etc/hosts and DNS follows . NIS+ is beyond the scope of this book.

The /etc/hosts File

This file contains one line for each host to IP address mapping. A line starts with an IP address followed by the official host name. The host name part may be followed by one or more host name aliases. An entry in the /etc/hosts file is of the following format.

 <IP address>   <Host name>   <aliases> 

Any line starting with the # symbol is a comment line. No entry can start with a space character in this file. The file is consulted from top to bottom. If you specify more than one line for a host name, only the first line is used for the resolution purpose.

Warning

A common mistake while configuring the host file is that you add a new entry for a host name at the end of the file while another entry already exists for that host. During the host name resolution process, the first entry is always used, as it is matched first while traversing the file from top to bottom. While adding a new entry, always check if it already exists or add a new entry at the start of the file instead of at the end.


A sample /etc/hosts file is shown next. The first line contains an entry for a host name myhp.boota.com , while a host name with the alias myhp is also used. The second line is for another host, hp0 . The third line shows a local host with a loopback address. The loopback address is the same for all systems and is used for testing purposes.

 ## Configured using SAM by root on Fri Dec  3 12:30:36 1998 # @(#)hosts $Revision: 1.9.214.1 $ $Date: 96/10/08 13:20:01 $ # 192.168.3.10   myhp.boota.com  myhp 192.168.3.12   hp0.boota.com   hp0 127.0.0.1      localhost       loopback 

Network Information Service

Network Information System (NIS) is used in small LANs. It was developed by Sun Microsystems; a more advanced resolution service with the name NIS+ was introduced later. NIS keeps a central data base of hosts and users and uses a flat name space that uses a master NIS server. Slave NIS servers can also be used to share load and provide redundancy in case of failure of the master server.

Domain Name Server

DNS uses a hierarchical naming scheme for assigning host names. A domain name server is a machine on a network that keeps a record of local host names within its zone of authority. It is used for both local and remote host name resolution if the network is connected to a public network. The resolver forwards all host name resolution queries to the domain name server. The name server looks into its own data files for a match. If a match is found, the query is answered straight away. If no match is found, the name server contacts a root name server on the Internet. The root name server provides the address of another DNS that can resolve the host name. Your name server then contacts the name server address provided by the root name server. When it receives the IP address of the host, it relays the address back to the querying machine. Figure 31-1 shows a sequence of steps before the command ftp hp23.boota.com initiates an FTP session with server hp23.boota.com .

Figure 31-1. Process of name resolution using DNS.

graphics/31fig01.gif

Usually more than one domain name server are used in a network. One of these acts as a primary domain name server and the others are secondary name servers. The secondary name servers take data from the primary name server.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net