host9 Command

Purpose

Performs DNS lookups.

Syntax

host9 [ -aCdlrsTwv ] [ -c class ] [ -N ndots ] [ -R number ] [ -t type ] [ -W wait ] [ -m flag ] [ -4 ] [ -6 ] name [ server ]

Description

The host9 command is a simple utility for performing DNS lookups. You can use this command to convert names to IP addresses and vice versa. When you specify no arguments or options, the host9 command prints a short summary of its command line arguments and options.

Flags

Item Description
-a Equivalent to using the flags of -v -t *.
-c class Instructs to make a DNS query of the specified class. You can use this flag to look up Hesiod or Chaosnet class resource records. The default class is IN (Internet).
-C Attempts to display the SOA records for the zone name from all of the listed authoritative name servers for that zone. The NS records found for the zone defines the list of name servers.
-d Generates the verbose output. This flag is equivalent to the -v flag.
-l Specifies the list mode. This makes the host9 command perform a zone transfer for the zone name. Transfers the zone printing out the NS, PTR and address records (A/AAAA). If you use the -l flag with the -a flag, the host9 command prints all records.
-m flag Sets the memory usage debugging flags record, usage, and trace.
-N ndots Sets the number of dots that have to be in the name for it to be considered absolute. The default value is that defined using the ndots statement in the /etc/resolv.conf file, or 1 if no ndots statement is present. Names with fewer dots are interpreted as relative names and will be searched for in the domains listed in the search or domain directive in the /etc/resolv.conf file.
-r Enables the host9 command to mimic the behavior of a name server by making non-recursive queries and expecting to receive answers to those queries that are usually referrals to other name servers.
-R number Changes the number of UDP retries for a lookup. The number value indicates how many times the host9 command repeats a query that does not get answered. The default number of retries is 1. If the number is negative or zero, the number of retries defaults to 1.
-s Informs the host9 command not to send the query to the next name server if any server responds with a SERVFAIL response.
-t type Selects the query type. The type can be any recognized query type: CNAME, NS, SOA, and so on. When no query type is specified, the host9 command automatically selects an appropriate query type. By default, it looks for A records, but if you specify the -C flag, queries are made for SOA records, and if name is a dotted-decimal IPv4 address or colon-delimited IPv6 address, the host9 command queries for PTR records. If a query type of IXFR is chosen, you can specify the starting serial by appending an equal sign, followed by the starting serial number (for example, -t IXFR=12345678).
-T Uses a TCP connection when querying the name server. TCP is automatically selected for queries that require it, such as zone transfer (AXFR) requests.
-v Generates the verbose output. This flag is equivalent to the -d flag.
-w Waits forever for a reply. The time to wait for a response is set to the number of seconds given by the hardware's maximum value for an integer quantity.
-W wait Waits for the wait seconds. If the wait value is less than one, the wait interval is set to 1 second.
-4 Forces the host9 command to only use IPv4 query transport.
-6 Forces the host9 command to only use IPv6 query transport.
name Specifies the domain name that is to be looked up. It can also be a dotted-decimal IPv4 address or a colon-delimited IPv6 address, in which case the host9 command performs a reverse lookup for that address.
server Specifies an optional argument, which is either the name or IP address of the name server that the host9 command queries instead of the server or servers listed in the /etc/resolv.conf file.

IDN SUPPORT

If the host9 command has been built with internationalized domain name (IDN) support, it can accept and display non-ASCII domain names. The host9 command appropriately converts character encoding of domain names before sending a request to the DNS server or displaying a reply from the server. If you'd like to turn off the IDN support for some reason, define the IDN DISABLE environment variable; the IDN support is disabled if the variable is set when the host9 command runs.

Files

Item Description
/etc/resolv.conf  

Examples

  1. To display the address of a host machine named mephisto, enter the following command:
    host9 mephisto
    This command displays information similar to the following:
    mephisto is 192.100.13.5, Aliases: engr, sarah
  2. To display the host machine with an address of 192.100.13.1, enter the following command:
    host9 192.100.13.1
    This command displays information similar to the following:
    mercutio is 192.100.13.1
  3. To display the MX records for the domain named test.ibm.com, enter the following command:
    host9 -n -t mx test.ibm.com
    This command displays information similar to the following:
    test.ibm.com mail is handled (pri=10) by test1.tt.ibm.com
    test.ibm.com mail is handled (pri=10) by test2.aix.ibm.com