GETHOST(1)GETHOST(1)

Index

BSD mandoc
 

NAME

gethost - do host lookups using system libraries  

SYNOPSIS

[-6 ] [-t ] [-x ] [hostname ... ]  

DESCRIPTION

The utility does hostname and IP lookups. It returns the hostname, any aliases, the IPv4 or IPv6 address, and, optionally, the time taken for each hostname to lookup. It uses standard Unix libraries instead of using direct DNS resolver lookups. This is useful in troubleshooting, because it will do lookups as your system sees them.

For example, if your nsswitch.conf(5) name-service configuration uses

hosts             files dns
then it will do a lookup against /etc/hosts first.

The following options are available:

-6
Use IPv6 instead of default IPv4.
-t
Show the elapsed time of the lookup in fractional seconds.
-x
Do a reverse lookup; find a hostname from an IP address.

If no options are used, then it defaults to looking up the IP address for the hostname given on the command-line.

The options can be repeated for each hostname to lookup by placing before hostname.

If a colon ":" is seen in hostname, it is assumed to be an IPv6 address and a reverse lookup is attempted.  

RETURN VALUES

The utility exits 0 on success of last (or only) lookup. It returns >0 if an error occurs on the final lookup.

If the IP address is invalid or improperly formated, the return value is 2. If the host is unknown (or not found), then the return value is 3. If there is a problem with network address to display format conversion, the error value is 4.  

EXAMPLES

gethost -x 127.0.0.1 -t -6 localhost
will give the hostname for 127.0.0.1 and then give the IPv6 address for "localhost" and show the elapsed time for just that second lookup.

gethost 3ffe:8050:201:1860:290:27ff:feab:19a7
will return the hostname for that IPv6 address.

 

SEE ALSO

dig(1), dnsquery(1), host(1), gethostbyname(3), inet(3), hosts(5), nsswitch.conf(5), nslookup(8)
 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
EXAMPLES
SEE ALSO

This document was created by man2html using the manual pages.
Time: 08:15:02 GMT, July 06, 2002