31.7 Configuring the DNS Client

   

The resolver library on client servers is configured to contact a specific type of service for host name resolution. This is controlled through the name service switch file the /etc/nsswitch.conf . This file lists the order in which different services are tried for resolution purposes. Usually /etc/ hosts is used if DNS is not configured. If the DNS is configured, it is given preference over other methods . The names of DNS servers are listed in the /etc/resolv.conf file. Multiple DNS servers can be listed in this file, which are consulted in order.

Configuring the Name Service Switch

HP-UX uses a number of sources for information. For example, a host name may be resolved using the /etc/hosts file, DNS, or NIS server. The /etc/nsswitch.conf file controls which service will be used for a particular type of information and in what order. The following line in this file shows that DNS will be tried first for host name resolution and then the /etc/hosts file will be used.

 hosts:        dns files 

Configuring /etc/resolv.conf

When the resolver wishes to try a DNS for name resolution, it first checks the /etc/resolv.conf file for a list of domain names and DNS servers. Two types of lists are present in /etc/resolv.conf . The first part of the file contains a list of domains used for relative host names. Each line in this list starts with the search keyword. If a domain name is present in this list, you don't need to fully specify qualified host names in your commands. The resolver itself adds a domain name to a short host name during the resolution process. For example, if domain name boota.com is present in this file and you use a command telnet hp0 , the resolver will try to find host name hp0.boota.com . The second part of the file consists of a list of domain name servers. Each line in this part starts with the keyword nameserver followed by the IP address of the name server. A maximum of three name servers can be listed in this file. A sample /etc/resolv.conf file is shown next .

 search boota.com nameserver 192.168.3.10 nameserver 192.168.3.12 

The domain name servers are consulted in the order they occur in this file. If the first name server is available, others are not tried. To distribute the load on all name servers, the order of name servers on different client machines should be changed.

Note

The resolv.conf file should be set up on all machines in the domain, including the primary and secondary domain name servers.


Note

The nsswitch.conf file should be modified to put DNS first in line starting with the word hosts : so that a DNS is consulted before trying any other host name resolution method.


Testing with nslookup

The nslookup command is used for testing and resolving a host name. The host name to be resolved is provided on the command line. The command first contacts the DNS server in the /etc/resolv.conf file and displays an IP address corresponding to the host. A typical output of the command is as follows .

 #  nslookup www.hp.com  Name Server:  myhp.boota.com Address:  192.168.3.10 Trying DNS Non-authoritative answer: Name:    www.hp.com Addresses:  192.151.11.32, 192.151.11.13, 192.151.52.13           192.6.35.16, 192.151.52.10 # 

This command can also be used in interactive mode when invoked without any arguments. In this case, the command displays the address of the name server, which will be used for name resolution, and waits for user input at its prompt, a greater-than sign > . At this command prompt, the user enters a host name. The command then resolves it and displays a message showing the IP address. If the name can't be resolved, an error message is displayed instead. A typical session for resolving host name www.hp.com is shown next.

 #  nslookup  Name Server:  myhp.boota.com Address:  192.168.3.10 >  www.hp.com  Name Server:  hamdns2.ham.am.honda.com Address:  207.130.253.66 Trying DNS Name:    www.hp.com Addresses:  192.151.52.10, 192.151.11.32, 192.151.11.13,   192.151.52.13           192.6.35.16 >  exit  # 

The command can also be used for reverse name resolution. In that case, you can enter an IP address and the host name corresponding to that IP address as displayed.

 #  nslookup  Default Name Server:  myhp.boota.com Address:  192.168.3.10 >  192.151.52.10  Name Server:  hamdns2.ham.am.honda.com Address:  207.130.253.66 Trying DNS Name:    i3107im4.external.hp.com Address:  192.151.52.10 >  exit  # 

The default DNS server used by nslookup can be changed with the server sub-command. In the following session, the default server is changed to ns.uu.net before resolving host name www.hp.com.

 #  nslookup  Default Name Server:  myhp.boota.com Address:  192.168.3.10 >  server ns.uu.net  Default Name Server:  ns.uu.net Address:  137.39.1.3 >  www.hp.com  Name Server:  ns.uu.net Address:  137.39.1.3 Trying DNS Addresses:  192.151.52.10, 192.151.11.32, 192.151.11.13           192.151.52.13, 192.6.35.16 > 

   
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