xref: /openbsd-src/usr.bin/dig/host.1 (revision 41ce3b17e73f6b7d2d9e1a3d961e4bab2d895cb5)
1.\" $OpenBSD: host.1,v 1.4 2022/03/31 17:27:24 naddy 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: March 31 2022 $
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".
61The
62.Fl a
63option is normally equivalent to
64.Fl v
65.Fl t Cm ANY .
66It also affects the behaviour of the
67.Fl l
68list zone option.
69.It Fl C
70Check consistency:
71.Nm
72will query the SOA records for zone
73.Ar name
74from all the listed authoritative name servers for that zone.
75The list of name servers is defined by the NS records that are found for the
76zone.
77.It Fl c Ar class
78Query class: This can be used to lookup
79.Cm HS
80(Hesiod)
81or
82.Cm CH
83(Chaosnet) class resource records.
84The default class is
85.Cm IN
86(Internet).
87.It Fl d
88Print debugging traces.
89Equivalent to the
90.Fl v
91verbose option.
92.It Fl i
93Obsolete.
94Use the IP6.INT domain for reverse lookups of IPv6 addresses as defined in
95RFC 1886 and deprecated in RFC 4159.
96The default is to use IP6.ARPA as specified in RFC 3596.
97.It Fl l
98List zone:
99The
100.Nm
101command performs a zone transfer of
102zone
103.Ar name
104and prints out the NS, PTR and address records (A/AAAA).
105.Pp
106Together, the
107.Fl l
108.Fl a
109options print all records in the zone.
110.It Fl m Ar flag
111Memory usage debugging: the flag can be
112.Cm record ,
113.Cm usage ,
114or
115.Cm trace .
116You can specify the
117.Fl m
118option more than once to set multiple flags.
119.It Fl N Ar ndots
120The number of dots that have to be in
121.Ar name
122for it to be considered absolute.
123The default value is that defined using the ndots statement in
124.Pa /etc/resolv.conf ,
125or 1 if no ndots statement is present.
126Names with fewer dots are interpreted as relative names and will be searched for
127in the domains listed in the
128.Vt search
129or
130.Vt domain
131directive in
132.Pa /etc/resolv.conf .
133.It Fl R Ar number
134Number of retries for UDP queries:
135If
136.Ar number
137is negative or zero, the number of retries will default to 1.
138The default value is 1.
139.It Fl r
140Non-recursive query:
141Setting this option clears the RD (recursion desired) bit in the query.
142This should mean that the name server receiving the query will not attempt to
143resolve
144.Ar name .
145The
146.Fl r
147option enables
148.Nm
149to mimic the behavior of a name server by making non-recursive queries and
150expecting to receive answers to those queries that can be referrals to other
151name servers.
152.It Fl s
153Do
154.Em not
155send the query to the next name server if any server responds with a SERVFAIL
156response, which is the reverse of normal stub resolver behavior.
157.It Fl T
158TCP:
159By default,
160.Nm
161uses UDP when making queries.
162The
163.Fl T
164option makes it use a TCP connection when querying the name server.
165TCP will be automatically selected for queries that require it, such as zone
166transfer (AXFR) requests.
167.It Fl t Ar type
168Query type:
169The
170.Ar type
171argument can be any recognized query type:
172.Cm CNAME ,
173.Cm NS ,
174.Cm SOA ,
175.Cm TXT ,
176.Cm DNSKEY ,
177.Cm AXFR ,
178etc.
179.Pp
180When no query type is specified,
181.Nm
182automatically selects an appropriate query type.
183By default, it looks for A, AAAA, and MX records.
184If the
185.Fl C
186option is given, queries will be made for SOA records.
187If
188.Ar name
189is a dotted-decimal IPv4 address or colon-delimited IPv6 address,
190.Nm
191will query for PTR records.
192.Pp
193If a query type of
194.Cm IXFR
195is chosen, the starting serial number can be specified by appending an equal
196followed by the starting serial number (like
197.Fl t Cm IXFR= Ns Ar 12345678 ) .
198.It Fl V
199Print the version number and exit.
200.It Fl v
201Verbose output.
202Equivalent to the
203.Fl d
204debug option.
205.It Fl W Ar wait
206Timeout: Wait for up to
207.Ar wait
208seconds for a reply.
209If
210.Ar wait
211is less than one, the wait interval is set to one second.
212.Pp
213By default,
214.Nm
215will wait for 5 seconds for UDP responses and 10 seconds for TCP connections.
216.It Fl w
217Wait forever: The query timeout is set to the maximum possible.
218.El
219.Sh FILES
220.Pa /etc/resolv.conf
221.Sh SEE ALSO
222.Xr dig 1
223.Sh AUTHORS
224.An -nosplit
225.An Internet Systems Consortium, Inc .
226