man pages section 1M: System Administration Commands
  Search only this book
View this book in:
Download this book in PDF (5578 KB)

nstest(1M)

NAME | SYNOPSIS | DESCRIPTION | OPTIONS | USAGE | EXAMPLES | FILES | ATTRIBUTES | SEE ALSO

NAME

    nstest– DNS test shell

SYNOPSIS

    nstest [-d] [-i] [-r] [-v] [-p port] [inet_addr[logfile]]

DESCRIPTION

    nstest is an interactive DNS test program. Queries are formed and sent by user command; any reply received is printed on the standard output. inet_addr is the Internet address of the DNS resolver to which nstest should send its queries. If inet_addr is not included, nstest first tries to contact a DNS server on the local host; if that fails, it tries the servers listed in the /etc/resolv.conf file. If a logfile is supplied, nstest uses it to log the queries sent and replies received.

OPTIONS

    -d

    Causes nstest to create a file named ns_packet.dump (if it does not exist) and write into it a raw (binary) copy of each packet sent. If ns_packet.dump does exist, nstest will truncate it.

    -i

    Sets the RES_IGNTC flag on the queries it makes. See resolver(3RESOLV) for a description of the RES_IGNTC flag.

    -r

    Turns off the RES_RECURSE flag on the queries it makes. See resolver(3RESOLV) for a description of the RES_RECURSE flag.

    -v

    Turns on the RES_USEVC and RES_STAYOPEN flags on the res_send () calls made. See resolver(3RESOLV) for a description of the RES_USEVC and RES_STAYOPEN flags.

    -p

    Causes nstest to use the supplied port instead of the default name server port.

USAGE

    When nstest starts, it prints a prompt (">") and waits for user input. DNS queries are formed by typing a key letter followed by the appropriate argument. Each key letter results in a call to res_mkquery () with op set to either IQUERY or QUERY and type set to one of the type values (defined in <arpa/nameser.h>). (Any other key letter than those listed below causes nstest to print a summary of the following table.)

    Key Letter &
    ArgumentOpType
       
    ahostQUERYT_A
    AaddrIQUERYT_A
    BuserQUERYT_MG
    buserQUERYT_MB
    chostQUERYT_CNAME
    fhostQUERYT_UINFO
    GgidIQUERYT_GID
    ghostQUERYT_GID
    hhostQUERYT_HINFO
    ihostQUERYT_MINFO
    MhostQUERYT_MAILB
    mhostQUERYT_MX
    nhostQUERYT_NS
    phostQUERYT_PTR
    rhostQUERYT_MR
    shostQUERYT_SOA
    ThostQUERYT_TXT
    UuidIQUERYT_UID
    uhostQUERYT_UID
    whostQUERYT_WKS
    xhostQUERYT_AXFR

    After the query is successfully formed, res_send () is called to send it and wait for a reply. nstest then prints the following on the standard output:

    • a summary of the request and reply packets, including the HEADER structure (defined in <arpa/nameser.h>) used in the request

    • the question being asked of the name server

    • an enumeration of the name server(s) being polled

    • a summary of the HEADER structure received in the reply

    • the question the name server answered

    • the answer itself

EXAMPLES


    Example 1 Fetching the Address of a Host From the Sun Name Server

    The following command fetches the address of host playground.sun.com from the Sun name server:


    $ nstest 192.9.5.1
    > aplayground.sun.com

    The utility nstest returns the following:


    res_mkquery(0, playground.sun.com, 1, 1)
    res_send()
    HEADER:
            opcode = QUERY, id = 1, rcode = NOERROR
            header flags:  rd
            qdcount = 1, ancount = 0, nscount = 0, arcount = 0
    
    QUESTIONS:
            playground.sun.com, type = A, class = IN
    
    Querying server (# 1) address = 192.9.5.1
    got answer:
    HEADER:
            opcode = QUERY, id = 1, rcode = NOERROR
            header flags:  qr aa rd ra
            qdcount = 1, ancount = 1, nscount = 0, arcount = 0
    
    QUESTIONS:
            playground.sun.com, type = A, class = IN
    ANSWERS:
            playground.sun.com
            type = A, class = IN, ttl = 1 day, dlen = 4
            internet address = 192.9.5.5


    Example 2 Looking Up a PTR record

    The following command looks up a PTR record:


    $ nstest 192.9.5.1
    > p5.5.9.192.in-addr.arpa

    The utility nstest would return the following:


    res_mkquery(0, 5.5.9.192.in-addr.arpa, 1, 12)
    res_send()
    HEADER:
            opcode = QUERY, id = 2, rcode = NOERROR
            header flags:  rd
            qdcount = 1, ancount = 0, nscount = 0, arcount = 0
    
    QUESTIONS:
            5.5.9.192.in-addr.arpa, type = PTR, class = IN
    
    Querying server (# 1) address = 192.9.5.1
    got answer:
    HEADER:
            opcode = QUERY, id = 2, rcode = NOERROR
            header flags:  qr aa rd ra
            qdcount = 1, ancount = 1, nscount = 0, arcount = 0
    
    QUESTIONS:
            5.5.9.192.in-addr.arpa, type = PTR, class = IN
    
    ANSWERS:
            5.5.9.192.in-addr.arpa
            type = PTR, class = IN, ttl = 7 hours 47 mins 2 secs, dlen = 23
            domain name = playground.sun.com

FILES

    /usr/include/arpa/nameser.h

    Include file for implementation of DNS protocol

    /usr/include/resolv.h

    Include file for the resolver daemon (in.named)

ATTRIBUTES

    See attributes(5) for descriptions of the following attributes:

    ATTRIBUTE TYPE 

    ATTRIBUTE VALUE 

    Availability 

    SUNWcsu 

SEE ALSO

SunOS 5.9  Last Revised 7 Apr 1994

NAME | SYNOPSIS | DESCRIPTION | OPTIONS | USAGE | EXAMPLES | FILES | ATTRIBUTES | SEE ALSO