
DIG(1)                  FreeBSD General Commands Manual                 DIG(1)

NNAAMMEE
     ddiigg - send domain name query packets to name servers

SSYYNNOOPPSSIISS
     ddiigg [@@_s_e_r_v_e_r] _d_o_m_a_i_n [<_q_u_e_r_y_-_t_y_p_e>] [<_q_u_e_r_y_-_c_l_a_s_s>] [++<_q_u_e_r_y_-_o_p_t_i_o_n>]
         [--<_d_i_g_-_o_p_t_i_o_n>] [_%_c_o_m_m_e_n_t]

DDEESSCCRRIIPPTTIIOONN
     DDiigg (domain information groper) is a flexible command line tool which can
     be used to gather information from the Domain Name System servers.  DDiigg
     has two modes: simple interactive mode for a single query, and batch mode
     which executes a query for each in a list of several query lines. All
     query options are accessible from the command line.

     The usual simple use of ddiigg will take the form:

                 ddiigg @@_s_e_r_v_e_r _d_o_m_a_i_n _q_u_e_r_y_-_t_y_p_e _q_u_e_r_y_-_c_l_a_s_s

     where:

     _s_e_r_v_e_r      may be either a domain name or a dot-notation Internet ad-
                 dress. If this optional field is omitted, ddiigg will attempt to
                 use the default name server for your machine.

                 _N_o_t_e_: If a domain name is specified, this will be resolved
                 using the domain name system resolver (i.e., BIND). If your
                 system does not support DNS, you may _h_a_v_e to specify a dot-
                 notation address.  Alternatively, if there is a server at
                 your disposal somewhere,  all that is required is that
                 _/_e_t_c_/_r_e_s_o_l_v_._c_o_n_f be present and indicate where the default
                 name servers reside,  so that _s_e_r_v_e_r itself can be resolved.
                 See resolver(5) for information on _/_e_t_c_/_r_e_s_o_l_v_._c_o_n_f. WWAARRNNIINNGG::
                 Changing _/_e_t_c_/_r_e_s_o_l_v_._c_o_n_f will affect both the standard re-
                 solver library and (potentially) several programs which use
                 it.  As an option, the user may set the environment variable
                 LOCALRES to name a file which is to be used instead of
                 _/_e_t_c_/_r_e_s_o_l_v_._c_o_n_f standard resolver (LOCALRESis specific to
                 the ddiigg resolver and  is  not  referenced  by  the). If the
                 LOCALRES variable is not set or the specified file is not
                 readable, then _/_e_t_c_/_r_e_s_o_l_v_._c_o_n_f will be used.

     _d_o_m_a_i_n      is the domain name for which you are requesting information.
                 See the --xx option (documented in the _O_T_H_E_R _O_P_T_I_O_N_S subsection
                 of this section) for convenient way to specify inverse ad-
                 dress query.

     _q_u_e_r_y_-_t_y_p_e  is the type of information (DNS query type) that you are re-
                 questing. If omitted, the default is ``_a'' (T_A = _a_d_d_r_e_s_s).
                 The following types are recognized:

                 _a       T_A        network address
                 _a_n_y     T_ANY      all/any information about specified domain
                 _m_x      T_MX       mail exchanger for the domain
                 _n_s      T_NS       name servers
                 _s_o_a     T_SOA      zone of authority record
                 _h_i_n_f_o   T_HINFO    host information
                 _a_x_f_r    T_AXFR     zone transfer (must ask an authoritative
                                    server)
                 _t_x_t     T_TXT      arbitrary number of strings



                 (See RFC 1035 for the complete list.)

     _q_u_e_r_y_-_c_l_a_s_s
                 is the network class requested in the query. If omitted, the
                 default is ``_i_n'' (C_IN = _I_n_t_e_r_n_e_t). The following classes
                 are recognized:

                 _i_n      C_IN       Internet class domain
                 _a_n_y     C_ANY      all/any class information

                 (See RFC 1035 for the complete list.)

                 _N_o_t_e_: ``_A_n_y'' can be used to specify a _c_l_a_s_s and/or a _t_y_p_e of
                 query.  DDiigg will parse the first occurrence of ``_a_n_y'' to
                 mean _q_u_e_r_y_-_t_y_p_e _= T_ANY. To specify _q_u_e_r_y_-_c_l_a_s_s _= C_ANY, you
                 must either specify ``any'' twice, or set _q_u_e_r_y_-_c_l_a_s_s using
                 the --cc option (see below).

   OOTTHHEERR OOPPTTIIOONNSS

     %_i_g_n_o_r_e_d_-_c_o_m_m_e_n_t
                 ``%'' is used to included an argument that is simply not
                 parsed.  This may be useful  if running ddiigg in batch mode.
                 Instead of resolving every _@_s_e_r_v_e_r_-_d_o_m_a_i_n_-_n_a_m_e in a list of
                 queries, you can avoid the overhead of doing so, and still
                 have the domain name on the command line as a reference. Ex-
                 ample:

                             ddiigg @@112288..99..00..3322 %%vveenneerraa..iissii..eedduu mmxx iissii..eedduu

     --<_d_i_g _o_p_t_i_o_n>
                 ``--'' is used to specify an option which affects the opera-
                 tion of ddiigg. The following options are currently available
                 (although not guaranteed to be useful):

                 --xx _d_o_t_-_n_o_t_a_t_i_o_n_-_a_d_d_r_e_s_s
                             Convenient form to specify inverse address map-
                             ping.  Instead of ``ddiigg 3322..00..99..112288..iinn--
                             aaddddrr..aarrppaa'', one can simply ``ddiigg --xx
                             112288..99..00..3322''.

                 --ff _f_i_l_e     File for ddiigg batch mode. The file contains a list
                             of query specifications ( ddiigg command lines)
                             which are to be executed successively.  Lines be-
                             ginning with `;', `#', or `\n' are ignored.  Oth-
                             er options may still appear on command line, and
                             will be in effect for each batch query.

                 --TT _t_i_m_e     Time in seconds between start of successive
                             queries when running in batch mode. Can be used
                             to keep two or more batch ddiigg commands running
                             roughly in sync.  Default is zero.

                 --pp _p_o_r_t     Port number. Query a name server listening to a
                             non-standard port number.  Default is 53.

                 --PP[_p_i_n_g_-_s_t_r_i_n_g]
                             After query returns, execute a ping(8) command
                             for response time comparison.  This rather unele-
                             gantly makes a call to the shell.  The last three
                             lines of statistics is printed for the command:

                                         ppiinngg --ss --sseerrvveerr__nnaammee --5566 --33

                             If the optional ``_p_i_n_g___s_t_r_i_n_g'' is present, it

                             replaces ``ppiinngg --ss'' in the shell command.

                 --tt _q_u_e_r_y_-_t_y_p_e
                             Specify type of query.  May specify either an in-
                             teger value to be included in the type field or
                             use the abbreviated mnemonic as discussed above
                             (i.e., _m_x _= T_MX).

                 --cc _q_u_e_r_y_-_c_l_a_s_s
                             Specify class of query. May specify either an in-
                             teger value to be included in the class field or
                             use the abbreviated mnemonic as discussed above
                             (i.e., in = C_IN).

                 --kk _k_e_y_d_i_r_:_k_e_y_n_a_m_e
                             Sign the query with the TSIG key named keyname
                             that is in the directory keydir.

                 --eennvvssaavv     This flag specifies that the ddiigg environment (de-
                             faults, print options, etc.), after all of the
                             arguments are parsed, should be saved to a file
                             to become the default environment.  This is use-
                             ful if you do not like the standard set of de-
                             faults and do not desire to include a large num-
                             ber of options each time ddiigg is used.  The envi-
                             ronment consists of resolver state variable
                             flags, timeout, and retries as well as the flags
                             detailing ddiigg output (see below).  If the shell
                             environment variable LOCALDEF is set to the name
                             of a file, this is where the default ddiigg environ-
                             ment is saved.  If not, the file ``_D_i_G_._e_n_v'' is
                             created in the current working directory.

                             _N_o_t_e_: LOCALDEF is specific to the ddiigg resolver,
                             and will not affect operation of the standard re-
                             solver library.

                             Each time ddiigg is executed, it looks for
                             ``_._/_D_i_G_._e_n_v'' or the file specified by the shell
                             environment variable LOCALDEF. If such file ex-
                             ists and is readable, then the environment is re-
                             stored from this file before any arguments are
                             parsed.

                 --eennvvsseett     This flag only affects batch query runs. When
                             ``--eennvvsseett'' is specified on a line in a ddiigg batch
                             file, the ddiigg environment after the arguments are
                             parsed becomes the default environment for the
                             duration of the batch file, or until the next
                             line which specifies ``--eennvvsseett''.

                 --[nnoo] ssttiicckk
                             This flag only affects batch query runs.  It
                             specifies that the ddiigg environment (as read ini-
                             tially or set by ``--eennvvsseett'' switch) is to be re-
                             stored before each query (line) in a ddiigg batch
                             file.  The default ``--nnoossttiicckk'' means that the
                             ddiigg environment does not stick, hence options
                             specified on a single line in a ddiigg batch file
                             will remain in effect for subsequent lines (i.e.
                             they are not restored to the ``sticky'' default).

     ++<_q_u_e_r_y_-_o_p_t_i_o_n>
                 ``+'' is used to specify an option to be changed in the query
                 packet or to change ddiigg output specifics. Many of these are
                 the same parameters accepted by nslookup(8).  If an option
                 requires a parameter, the form is as follows:

                             ++ _k_e_y_w_o_r_d [=_v_a_l_u_e]

                 Most keywords can be abbreviated.  Parsing of the ``+'' op-
                 tions  is very  simplistic -- a value must not be separated
                 from its keyword by white space. The following keywords are
                 currently available:

                 Keyword      Abbrev.  Meaning [default]

                 [nnoo] ddeebbuugg     (ddeebb)    turn on/off debugging mode [ddeebb]
                 [nnoo] dd22                 turn on/off extra debugging mode
                                         [nnoodd22]
                 [nnoo] rreeccuurrssee   (rreecc)    use/don't use recursive lookup [rreecc]
                 rreettrryy==_#       (rreett)     set number of retries to # [4]
                 ttiimmee==_#        (ttii)      set timeout length to # seconds [4]
                 [nnoo] kkoo                 keep open option (implies vc) [nnookkoo]
                 [nnoo] vvcc                 use/don't use virtual circuit [nnoovvcc]
                 [nnoo] ddeeffnnaammee   (ddeeff)    use/don't use default domain name
                                         [ddeeff]
                 [nnoo] sseeaarrcchh    (sseeaa)    use/don't use domain search list
                                         [sseeaa]
                 ddoommaaiinn==_N_A_M_E   (ddoo)      set default domain name to _N_A_M_E
                 [nnoo] iiggnnoorree    (ii)      ignore/don't ignore trunc. errors
                                         [nnooii]
                 [nnoo] pprriimmaarryy   (pprr)     use/don't use primary server [nnoopprr]
                 [nnoo] aaaaoonnllyy    (aaaa)     authoritative query only flag [nnooaaaa]
                 [nnoo] ccmmdd                echo parsed arguments [ccmmdd]
                 [nnoo] ssttaattss     (sstt)     print query statistics [sstt]
                 [nnoo] HHeeaaddeerr    (HH)      print basic header [HH]
                 [nnoo] hheeaaddeerr    (hhee)     print header flags [hhee]
                 [nnoo] ttttlliidd     (tttt)     print TTLs [tttt]
                 [nnoo] ccll                 print class info [nnooccll]
                 [nnoo] qqrr                 print outgoing query [nnooqqrr]
                 [nnoo] rreeppllyy     (rreepp)    print reply [rreepp]
                 [nnoo] qquueess      (qquu)     print question section [qquu]
                 [nnoo] aannsswweerr    (aann)     print answer section [aann]
                 [nnoo] aauutthhoorr    (aauu)     print authoritative section [aauu]
                 [nnoo] aaddddiitt     (aadd)     print additional section [aadd]
                 ppffddeeff                   set to default print flags
                 ppffmmiinn                   set to minimal default print flags
                 ppffsseett==_#                 set print flags to # (# can be
                                         hex/octal/decimal)
                 ppffaanndd==_#                 bitwise and print flags with #
                 ppffoorr==_#                  bitwise or print flags with #

                 The rreettrryy and ttiimmee options affect the retransmission strategy
                 used by the resolver library when sending datagram queries.
                 The algorithm is as follows:

                       for i = 0 to retry - 1
                           for j = 1 to num_servers
                               send_query
                               wait((time * (2**i)) / num_servers)
                           end
                       end

                 (Note: ddiigg always uses a value of 1 for ``num_servers''.)

   DDEETTAAIILLSS
     DDiigg once required a slightly modified version of the BIND resolver(3) li-
     brary.  As of BIND 4.9, BIND's resolver has been augmented to work prop-
     erly with ddiigg. Essentially, ddiigg is a straight-forward (albeit not pretty)
     effort of parsing arguments and setting appropriate parameters.  DDiigg uses
     resolver(3) routines rreess__iinniitt(), rreess__mmkkqquueerryy(), rreess__sseenndd() as well as ac-
     cessing the ___r_e_s structure.

EENNVVIIRROONNMMEENNTT
     LOCALRES    file to use in place of Pa /etc/resolv.conf
     LOCALDEF    default environment file

     See also the explanation of the --eennvvssaavv, --eennvvsseett, and --[nnoo] ssttiicckk op-
     tions, above.

FFIILLEESS
     /etc/resolv.conf
                         initial domain name and name server addresses
     ./DiG.env           default save file for default options

SSEEEE AALLSSOO
     named(8),  resolver(3),  resolver(5),  nslookup(8).

SSTTAANNDDAARRDDSS
     RFC 1035.

AAUUTTHHOORR
     Steve Hotz hotz@isi.edu

AACCKKNNOOWWLLEEDDGGMMEENNTTSS
     DDiigg uses functions from nslookup(8) authored by Andrew Cherenson.

BBUUGGSS
     DDiigg has a serious case of "creeping featurism" -- the result of consider-
     ing several potential uses during it's development.  It would probably
     benefit from a rigorous diet.  Similarly, the print flags and granularity
     of the items they specify make evident their rather ad hoc genesis.

     DDiigg does not consistently exit nicely (with appropriate status) when a
     problem occurs somewhere in the resolver (NNOOTTEE::most of the common exit
     cases are handled). This is particularly annoying when running in batch
     mode.  If it exits abnormally (and is not caught), the entire batch
     aborts; when such an event is trapped, ddiigg simply continues with the next
     query.

4th Berkeley Distribution       August 30, 1990                              5
