Fully qualified and unqualified hostnames

DNS and NIS have different semantics when it comes to dealing with qualified and unqualified hostnames. A fully qualified hostname is one that includes the DNS domain name as the suffix, whereas the unqualified hostname does not have a domain suffix. So for example, gonzo.sales.polygon.com is a fully qualified DNS name, but gonzo is an unqualified name. With both DNS and NIS, there is associated with the name service configuration a default domain name. If an unqualified hostname is passed to gethostbyname( ) to be resolved, then both DNS and NIS will associate the query with the default domain name. When doing an address to name query, such as via gethostbyaddr( ), DNS and NIS behave differently. DNS will always return the fully qualified hostname, whereas NIS may return the unqualified hostname. You can do one of two things to address this issue: The fully qualified versus unqualified hostname issue can produce practical problems on the server side of services like NFS and rlogin, which have lists of hostnames to control access. If the server has both NIS and DNS enabled, then it is possible that sometimes clients will have hostnames that appear as unqualified, and sometimes as fully qualified. Unless the hostnames that appear in files such as /etc/dfs/dfstab or /etc/hosts.equiv correspond with what the directory service uses, access will be mistakenly denied. For example, while we have not covered NFS operation yet, this is as good as place as any to explain a common NFS access problem when DNS is being used to resolve hostnames to IP addresses. Suppose you have the following entry in /etc/dfs/dfstab:

share -o rw=gonzo /export


If DNS is being used, NFS client gonzo will be denied access. This is because if DNS is being used to resolve hostnames to IP addresses, it is also being used to resolve IP addresses to hostnames, and DNS always generates fully qualified hostnames. Thus if gonzo is in the sales.polygon.com domain, then the following gives gonzo access:

share -o rw=gonzo.sales.polygon.com /export


The qualified versus unqualified hostname issue is one that has the potential for causing you major grief, and at the end of the day, you may decide that it is far simpler to use DNS across the board. If you do opt to use both NIS and DNS, for consistent results, the following is recommended: