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.confThis 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
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
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.
/etc/resolv.confThis 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.
|