Products   Support   Download   Contact

GETHOSTBYNAME() FAILURES ON HP-UX

Contents | Index | About the Icons

Abstract

The ScriptServer® PAN Printing System (PAN) uses gethostbyname() calls on Unix-like operating systems to get the host's IP address. It might seem reasonable that a host would be able to get its address from its name, but sometimes this fails... which in turn causes PAN to fail.

Although the behavior documented in this memo has only been seen on HP-UX, Sun Solaris uses similar mechanisms.

Default Resolver Behavior on HP-UX

As documented in the man page for nsswitch.conf on HP-UX, the default behavior to resolve a hostname is to first consult DNS or NIS and only if these are unavailable is the /etc/hosts file consulted.

There is actually more subtlety in observed behavior which results from the above than that which first meets the eye. In particular: no name service is not the same as no such name, and if the name service returns "no such name" then /etc/hosts is not consulted.

The philosophical implications of trusting in an external authority to validate your existence and being told by said authority "you don't exist" are beyond the scope of this memo.

The PAN Host Needs To Be Able to Resolve Itself

Nameservice failures (when in fact the host does exist) such as the above can be transitory in nature and difficult to detect. Mitigating this problem may be as simple as creating a /etc/nsswitch.conf file with a single entry:

hosts: files dns

presuming you are using DNS as your name service, and a similar entry is possible for NIS or NIS+. The important thing is that files comes first and that unless this turns up a positive result the name service is consulted. Naturally a corresponding entry for the host is needed in /etc/hosts as well.

NOTE: The specifics of name services configuration can have a significant impact on security and network performance. The information on configuring name services above is presented for illustration only, and not as a recommendation by GrayMatter Software as to how name services should be configured in any particular case. GrayMatter Software is not responsible for network configuration at customer's sites, and urges that you conduct an appropriate review of the security and performance impacts of any contemplated changes prior to implementation.

© 2020 GrayMatter Software Corporation