xref: /openbsd/usr.bin/dig/host.1 (revision 73471bf0)
1.\" $OpenBSD: host.1,v 1.2 2021/06/12 06:39:17 jmc Exp $
2.\"
3.\" Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2018 Internet Systems Consortium, Inc. ("ISC")
4.\"
5.\" Permission to use, copy, modify, and/or distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15.\" PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: June 12 2021 $
18.Dt HOST 1
19.Os
20.Sh NAME
21.Nm host
22.Nd DNS lookup utility
23.Sh SYNOPSIS
24.Nm
25.Op Fl 46aCdilrsTVvw
26.Op Fl c Ar class
27.Op Fl m Ar flag
28.Op Fl N Ar ndots
29.Op Fl R Ar number
30.Op Fl t Ar type
31.Op Fl W Ar wait
32.Ar name
33.Op Ar server
34.Sh DESCRIPTION
35The
36.Nm
37command is a simple utility for performing DNS lookups.
38It is normally used to convert names to IP addresses and vice versa.
39.Pp
40.Ar name
41is the domain name that is to be looked up.
42It can also be a dotted-decimal IPv4 address or a colon-delimited IPv6
43address, in which case
44.Nm
45will by default perform a reverse lookup for that address.
46.Ar server
47is an optional argument which is either the name or IP address of the name
48server that
49.Nm
50should query instead of the server or servers listed in
51.Pa /etc/resolv.conf .
52.Pp
53The options are as follows:
54.Bl -tag -width Ds
55.It Fl 4
56Use IPv4 only for query transport.
57.It Fl 6
58Use IPv6 only for query transport.
59.It Fl a
60"All". The
61.Fl a
62option is normally equivalent to
63.Fl v
64.Fl t Cm ANY .
65It also affects the behaviour of the
66.Fl l
67list zone option.
68.It Fl C
69Check consistency:
70.Nm
71will query the SOA records for zone
72.Ar name
73from all the listed authoritative name servers for that zone.
74The list of name servers is defined by the NS records that are found for the
75zone.
76.It Fl c Ar class
77Query class: This can be used to lookup
78.Cm HS
79(Hesiod)
80or
81.Cm CH
82(Chaosnet) class resource records.
83The default class is
84.Cm IN
85(Internet).
86.It Fl d
87Print debugging traces.
88Equivalent to the
89.Fl v
90verbose option.
91.It Fl i
92Obsolete.
93Use the IP6.INT domain for reverse lookups of IPv6 addresses as defined in
94RFC 1886 and deprecated in RFC 4159.
95The default is to use IP6.ARPA as specified in RFC 3596.
96.It Fl l
97List zone:
98The
99.Nm
100command performs a zone transfer of
101zone
102.Ar name
103and prints out the NS, PTR and address records (A/AAAA).
104.Pp
105Together, the
106.Fl l
107.Fl a
108options print all records in the zone.
109.It Fl m Ar flag
110Memory usage debugging: the flag can be
111.Cm record ,
112.Cm usage ,
113or
114.Cm trace .
115You can specify the
116.Fl m
117option more than once to set multiple flags.
118.It Fl N Ar ndots
119The number of dots that have to be in
120.Ar name
121for it to be considered absolute.
122The default value is that defined using the ndots statement in
123.Pa /etc/resolv.conf ,
124or 1 if no ndots statement is present.
125Names with fewer dots are interpreted as relative names and will be searched for
126in the domains listed in the
127.Vt search
128or
129.Vt domain
130directive in
131.Pa /etc/resolv.conf .
132.It Fl R Ar number
133Number of retries for UDP queries:
134If
135.Ar number
136is negative or zero, the number of retries will default to 1. The default value
137is 1.
138.It Fl r
139Non-recursive query:
140Setting this option clears the RD (recursion desired) bit in the query.
141This should mean that the name server receiving the query will not attempt to
142resolve
143.Ar name .
144The
145.Fl r
146option enables
147.Nm
148to mimic the behavior of a name server by making non-recursive queries and
149expecting to receive answers to those queries that can be referrals to other
150name servers.
151.It Fl s
152Do
153.Em not
154send the query to the next name server if any server responds with a SERVFAIL
155response, which is the reverse of normal stub resolver behavior.
156.It Fl T
157TCP:
158By default,
159.Nm
160uses UDP when making queries.
161The
162.Fl T
163option makes it use a TCP connection when querying the name server.
164TCP will be automatically selected for queries that require it, such as zone
165transfer (AXFR) requests.
166.It Fl t Ar type
167Query type:
168The
169.Ar type
170argument can be any recognized query type:
171.Cm CNAME ,
172.Cm NS ,
173.Cm SOA ,
174.Cm TXT ,
175.Cm DNSKEY ,
176.Cm AXFR ,
177etc.
178.Pp
179When no query type is specified,
180.Nm
181automatically selects an appropriate query type.
182By default, it looks for A, AAAA, and MX records.
183If the
184.Fl C
185option is given, queries will be made for SOA records.
186If
187.Ar name
188is a dotted-decimal IPv4 address or colon-delimited IPv6 address,
189.Nm
190will query for PTR records.
191.Pp
192If a query type of
193.Cm IXFR
194is chosen the starting serial number can be specified by appending an equal
195followed by the starting serial number (like
196.Fl t Cm IXFR= Ns Ar 12345678 ) .
197.It Fl V
198Print the version number and exit.
199.It Fl v
200Verbose output.
201Equivalent to the
202.Fl d
203debug option.
204.It Fl W Ar wait
205Timeout: Wait for up to
206.Ar wait
207seconds for a reply.
208If
209.Ar wait
210is less than one, the wait interval is set to one second.
211.Pp
212By default,
213.Nm
214will wait for 5 seconds for UDP responses and 10 seconds for TCP connections.
215.It Fl w
216Wait forever: The query timeout is set to the maximum possible.
217.El
218.Sh FILES
219.Pa /etc/resolv.conf
220.Sh SEE ALSO
221.Xr dig 1
222.Sh AUTHORS
223.An -nosplit
224.An Internet Systems Consortium, Inc .
225