Configuring a DNS Client


A DNS client uses the DNS servers to carry out name resolution. DNS servers are also configured as DNS clients because they can also issue queries to be resolved. The client configuration process consists of two separate steps: one to configure the system to use DNS as a mechanism for name resolution and the second to identify the DNS servers that should be contacted to carry out the resolution. The first step involves the file /etc/nsswitch.conf , and the second involves the file /etc/resolv.conf >. Both are covered in the following sections.

/etc/nsswitch.conf

This file is the name service switch file that allows the use of flat files or other name services (such as NIS, NIS+, or LDAP) to resolve various queries. For DNS purposes, there is only one entry in this file of interest: the hosts : entry. When a system is installed with Solaris 9, the default hosts: entry uses only the flat files for name resolution, namely /etc/inet/hosts . To change this entry to include DNS, modify the entry to the following:

 hosts:        files    dns 
graphics/alert_icon.gif

Solaris 9 provides a number of switch file templates, one of which is /etc/nsswitch.dns . This file can simply be copied to /etc/nsswitch.conf so that DNS resolution can apply. Be careful, though, if another name service is already in use (such as NIS) because doing this would overwrite the current configuration file and cause NIS problems. Read any exam question thoroughly to see whether any other name service is running before contemplating this as your answer.


The order of the entries in the switch file is important because DNS entries could be masked by entries in the local hosts file. A rogue entry in the hosts file could prevent DNS from being used to look up an IP address. You can also include a conditional statement that interprets the result of the query and takes a specific action based on the code returned from the query. There are four possible return codes, shown in Table 10.3.

Table 10.3. Name Resolution Return Codes

Code

Description

NOTFOUND

The required hostname entry was not found.

SUCCESS

The required hostname entry was found and resolved.

TRYAGAIN

The service was busy. Trying again might prove successful.

UNAVAIL

The service did not respond.

Two actions can be taken after the return code has been interpreted, namely continue or return . The continue action enables the query to try the next resolution method in the hosts: entry of the file, whereas the return action does not; it simply stops and the process fails.

As an example, consider what would happen if you had the following hosts: entry in your /etc/nsswitch.conf file:

 hosts:        files  [NOTFOUND=return]  dns 

The result is that if a hostname could not be resolved with the /etc/inet/hosts file, then the process would stop and not use DNS at all.

graphics/alert_icon.gif

You should be prepared for various scenarios involving the /etc/nsswitch.conf file. There are often questions that ask you to identify the resolution steps that would take place based on different hosts: entries. Make sure you understand the return codes and actions.


/etc/resolv.conf

This file specifies the DNS servers that the client can use to resolve hostnames/IP addresses. A sample /etc/resolv.conf is shown here with the most popular options:

 domain xyz.com search xyz.com nameserver 192.168.28.28;  Primary DNS server nameserver 192.168.28.72;  Secondary DNS server 

The domain entry identifies the current DNS domain name. The search entry identifies the domain name to append to queries that were not specified as fully qualified, such as if you queried the host sales rather than sales.xyz.com . The next two entries specify the IP addresses of two DNS servers that will attempt to resolve the query. You can enter up to three nameservers to consult , although it is normal to place the server that is physically nearest to you at the top so that it is always tried first.

graphics/note_icon.gif

If there are no nameserver entries, or if the file /etc/resolv.conf does not exist, the client tries to use its own loopback address to resolve the query.




Solaris 9 Network Administration Exam Cram 2 (Exam Cram CX-310-044)
Solaris 9 Network Administrator Exam Cram 2 (Exam CX-310-044)
ISBN: 0789728702
EAN: 2147483647
Year: 2003
Pages: 174
Authors: John Philcox

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