xref: /freebsd/contrib/openresolv/resolvconf.8.in (revision 9b3ece1c2eb92a881cb2553271e123382bfe31c1)
13f2a60a1SPedro F. Giffuni.\" Copyright (c) 2007-2016 Roy Marples
2587392a5SHajimu UMEMOTO.\" All rights reserved
3587392a5SHajimu UMEMOTO.\"
4587392a5SHajimu UMEMOTO.\" Redistribution and use in source and binary forms, with or without
5587392a5SHajimu UMEMOTO.\" modification, are permitted provided that the following conditions
6587392a5SHajimu UMEMOTO.\" are met:
7587392a5SHajimu UMEMOTO.\" 1. Redistributions of source code must retain the above copyright
8587392a5SHajimu UMEMOTO.\"    notice, this list of conditions and the following disclaimer.
9587392a5SHajimu UMEMOTO.\" 2. Redistributions in binary form must reproduce the above copyright
10587392a5SHajimu UMEMOTO.\"    notice, this list of conditions and the following disclaimer in the
11587392a5SHajimu UMEMOTO.\"    documentation and/or other materials provided with the distribution.
12587392a5SHajimu UMEMOTO.\"
13587392a5SHajimu UMEMOTO.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14587392a5SHajimu UMEMOTO.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15587392a5SHajimu UMEMOTO.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16587392a5SHajimu UMEMOTO.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17587392a5SHajimu UMEMOTO.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18587392a5SHajimu UMEMOTO.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19587392a5SHajimu UMEMOTO.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20587392a5SHajimu UMEMOTO.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21587392a5SHajimu UMEMOTO.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22587392a5SHajimu UMEMOTO.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23587392a5SHajimu UMEMOTO.\" SUCH DAMAGE.
24587392a5SHajimu UMEMOTO.\"
25*87b2cfceSPedro F. Giffuni.Dd November 29, 2016
26d7149f4eSGlen Barber.Dt RESOLVCONF 8
27587392a5SHajimu UMEMOTO.Os
28587392a5SHajimu UMEMOTO.Sh NAME
29587392a5SHajimu UMEMOTO.Nm resolvconf
30587392a5SHajimu UMEMOTO.Nd a framework for managing multiple DNS configurations
31587392a5SHajimu UMEMOTO.Sh SYNOPSIS
32587392a5SHajimu UMEMOTO.Nm
33587392a5SHajimu UMEMOTO.Fl I
34587392a5SHajimu UMEMOTO.Nm
35587392a5SHajimu UMEMOTO.Op Fl m Ar metric
36587392a5SHajimu UMEMOTO.Op Fl p
37d7149f4eSGlen Barber.Op Fl x
38d7149f4eSGlen Barber.Fl a Ar interface Ns Op Ar .protocol
39d7149f4eSGlen Barber.No < Ns Pa file
40587392a5SHajimu UMEMOTO.Nm
41587392a5SHajimu UMEMOTO.Op Fl f
42d7149f4eSGlen Barber.Fl d Ar interface Ns Op Ar .protocol
43587392a5SHajimu UMEMOTO.Nm
44d7149f4eSGlen Barber.Op Fl x
45587392a5SHajimu UMEMOTO.Fl il Ar pattern
46587392a5SHajimu UMEMOTO.Nm
47587392a5SHajimu UMEMOTO.Fl u
48*87b2cfceSPedro F. Giffuni.Nm
49*87b2cfceSPedro F. Giffuni.Fl Fl version
50587392a5SHajimu UMEMOTO.Sh DESCRIPTION
51587392a5SHajimu UMEMOTO.Nm
52587392a5SHajimu UMEMOTOmanages
53587392a5SHajimu UMEMOTO.Xr resolv.conf 5
54587392a5SHajimu UMEMOTOfiles from multiple sources, such as DHCP and VPN clients.
55587392a5SHajimu UMEMOTOTraditionally, the host runs just one client and that updates
56587392a5SHajimu UMEMOTO.Pa /etc/resolv.conf .
57587392a5SHajimu UMEMOTOMore modern systems frequently have wired and wireless interfaces and there is
58587392a5SHajimu UMEMOTOno guarantee both are on the same network.
59587392a5SHajimu UMEMOTOWith the advent of VPN and other
60587392a5SHajimu UMEMOTOtypes of networking daemons, many things now contend for the contents of
61587392a5SHajimu UMEMOTO.Pa /etc/resolv.conf .
62587392a5SHajimu UMEMOTO.Pp
63587392a5SHajimu UMEMOTO.Nm
64587392a5SHajimu UMEMOTOsolves this by letting the daemon send their
65587392a5SHajimu UMEMOTO.Xr resolv.conf 5
66587392a5SHajimu UMEMOTOfile to
67587392a5SHajimu UMEMOTO.Nm
68587392a5SHajimu UMEMOTOvia
693f2a60a1SPedro F. Giffuni.Xr stdin 4
70587392a5SHajimu UMEMOTOwith the argument
71d7149f4eSGlen Barber.Fl a Ar interface Ns Op Ar .protocol
72587392a5SHajimu UMEMOTOinstead of the filesystem.
73587392a5SHajimu UMEMOTO.Nm
74587392a5SHajimu UMEMOTOthen updates
75587392a5SHajimu UMEMOTO.Pa /etc/resolv.conf
76587392a5SHajimu UMEMOTOas it thinks best.
77587392a5SHajimu UMEMOTOWhen a local resolver other than libc is installed, such as
78587392a5SHajimu UMEMOTO.Xr dnsmasq 8
79587392a5SHajimu UMEMOTOor
80587392a5SHajimu UMEMOTO.Xr named 8 ,
81587392a5SHajimu UMEMOTOthen
82587392a5SHajimu UMEMOTO.Nm
83587392a5SHajimu UMEMOTOwill supply files that the resolver should be configured to include.
84587392a5SHajimu UMEMOTO.Pp
85587392a5SHajimu UMEMOTO.Nm
86d7149f4eSGlen Barberassumes it has a job to do.
87d7149f4eSGlen BarberIn some situations
88d7149f4eSGlen Barber.Nm
89d7149f4eSGlen Barberneeds to act as a deterrent to writing to
90d7149f4eSGlen Barber.Pa /etc/resolv.conf .
91d7149f4eSGlen BarberWhere this file cannot be made immutable or you just need to toggle this
92d7149f4eSGlen Barberbehaviour,
93d7149f4eSGlen Barber.Nm
94d7149f4eSGlen Barbercan be disabled by adding
95d7149f4eSGlen Barber.Sy resolvconf Ns = Ns NO
96d7149f4eSGlen Barberto
97d7149f4eSGlen Barber.Xr resolvconf.conf 5 .
98d7149f4eSGlen Barber.Pp
99d7149f4eSGlen Barber.Nm
100587392a5SHajimu UMEMOTOcan mark an interfaces
101587392a5SHajimu UMEMOTO.Pa resolv.conf
102587392a5SHajimu UMEMOTOas private.
103587392a5SHajimu UMEMOTOThis means that the name servers listed in that
104587392a5SHajimu UMEMOTO.Pa resolv.conf
105587392a5SHajimu UMEMOTOare only used for queries against the domain/search listed in the same file.
106587392a5SHajimu UMEMOTOThis only works when a local resolver other than libc is installed.
107587392a5SHajimu UMEMOTOSee
108587392a5SHajimu UMEMOTO.Xr resolvconf.conf 5
109587392a5SHajimu UMEMOTOfor how to configure
110587392a5SHajimu UMEMOTO.Nm
111*87b2cfceSPedro F. Giffunito use a local name server and how to remove the private marking.
112587392a5SHajimu UMEMOTO.Pp
113d7149f4eSGlen Barber.Nm
114d7149f4eSGlen Barbercan mark an interfaces
115d7149f4eSGlen Barber.Pa resolv.conf
116d7149f4eSGlen Barberas exclusive.
117d7149f4eSGlen BarberOnly the latest exclusive interface is used for processing, otherwise all are.
118d7149f4eSGlen Barber.Pp
119587392a5SHajimu UMEMOTOWhen an interface goes down, it should then call
120587392a5SHajimu UMEMOTO.Nm
121587392a5SHajimu UMEMOTOwith
122d7149f4eSGlen Barber.Fl d Ar interface.*
123587392a5SHajimu UMEMOTOarguments to delete the
124587392a5SHajimu UMEMOTO.Pa resolv.conf
125d7149f4eSGlen Barberfile(s) for all the
126d7149f4eSGlen Barber.Ar protocols
127d7149f4eSGlen Barberon the
128587392a5SHajimu UMEMOTO.Ar interface .
129587392a5SHajimu UMEMOTO.Pp
1303f2a60a1SPedro F. GiffuniHere are some options for the above commands:-
131*87b2cfceSPedro F. Giffuni.Bl -tag -width pattern_opt
132587392a5SHajimu UMEMOTO.It Fl f
1333f2a60a1SPedro F. GiffuniIgnore non existent interfaces.
134587392a5SHajimu UMEMOTOOnly really useful for deleting interfaces.
1353f2a60a1SPedro F. Giffuni.It Fl m Ar metric
1363f2a60a1SPedro F. GiffuniSet the metric of the interface when adding it, default of 0.
1373f2a60a1SPedro F. GiffuniLower metrics take precedence.
1383f2a60a1SPedro F. GiffuniThis affects the default order of interfaces when listed.
1393f2a60a1SPedro F. Giffuni.It Fl p
1403f2a60a1SPedro F. GiffuniMarks the interface
1413f2a60a1SPedro F. Giffuni.Pa resolv.conf
1423f2a60a1SPedro F. Giffunias private.
1433f2a60a1SPedro F. Giffuni.It Fl x
1443f2a60a1SPedro F. GiffuniMark the interface
1453f2a60a1SPedro F. Giffuni.Pa resolv.conf
1463f2a60a1SPedro F. Giffunias exclusive when adding, otherwise only use the latest exclusive interface.
1473f2a60a1SPedro F. Giffuni.El
1483f2a60a1SPedro F. Giffuni.Pp
1493f2a60a1SPedro F. Giffuni.Nm
1503f2a60a1SPedro F. Giffunihas some more commands for general usage:-
151*87b2cfceSPedro F. Giffuni.Bl -tag -width pattern_opt
152587392a5SHajimu UMEMOTO.It Fl i Ar pattern
153d7149f4eSGlen BarberList the interfaces and protocols, optionally matching
154587392a5SHajimu UMEMOTO.Ar pattern ,
155587392a5SHajimu UMEMOTOwe have
156587392a5SHajimu UMEMOTO.Pa resolv.conf
157587392a5SHajimu UMEMOTOfiles for.
158587392a5SHajimu UMEMOTO.It Fl l Ar pattern
159587392a5SHajimu UMEMOTOList the
160587392a5SHajimu UMEMOTO.Pa resolv.conf
161587392a5SHajimu UMEMOTOfiles we have.
162587392a5SHajimu UMEMOTOIf
163587392a5SHajimu UMEMOTO.Ar pattern
164d7149f4eSGlen Barberis specified then we list the files for the interfaces and protocols
165d7149f4eSGlen Barberthat match it.
166587392a5SHajimu UMEMOTO.It Fl u
167587392a5SHajimu UMEMOTOForce
168587392a5SHajimu UMEMOTO.Nm
169d7149f4eSGlen Barberto update all its subscribers.
170587392a5SHajimu UMEMOTO.Nm
171587392a5SHajimu UMEMOTOdoes not update the subscribers when adding a resolv.conf that matches
172587392a5SHajimu UMEMOTOwhat it already has for that interface.
173*87b2cfceSPedro F. Giffuni.It Fl Fl version
174*87b2cfceSPedro F. GiffuniEcho the resolvconf version to
175*87b2cfceSPedro F. Giffuni.Em stdout .
176587392a5SHajimu UMEMOTO.El
177587392a5SHajimu UMEMOTO.Pp
178587392a5SHajimu UMEMOTO.Nm
1793f2a60a1SPedro F. Giffunialso has some commands designed to be used by it's subscribers and
1803f2a60a1SPedro F. Giffunisystem startup:-
181*87b2cfceSPedro F. Giffuni.Bl -tag -width pattern_opt
1823f2a60a1SPedro F. Giffuni.It Fl I
1833f2a60a1SPedro F. GiffuniInitialise the state directory
1843f2a60a1SPedro F. Giffuni.Pa @VARDIR@ .
1853f2a60a1SPedro F. GiffuniThis only needs to be called if the initial system boot sequence does not
1863f2a60a1SPedro F. Giffuniautomatically clean it out; for example the state directory is moved
1873f2a60a1SPedro F. Giffunisomewhere other than
1883f2a60a1SPedro F. Giffuni.Pa /var/run .
1893f2a60a1SPedro F. GiffuniIf used, it should only be called once as early in the system boot sequence
1903f2a60a1SPedro F. Giffunias possible and before
1913f2a60a1SPedro F. Giffuni.Nm
1923f2a60a1SPedro F. Giffuniis used to add interfaces.
1933f2a60a1SPedro F. Giffuni.It Fl R
1943f2a60a1SPedro F. GiffuniEcho the command used to restart a service.
1953f2a60a1SPedro F. Giffuni.It Fl r Ar service
1963f2a60a1SPedro F. GiffuniIf the
1973f2a60a1SPedro F. Giffuni.Ar service
1983f2a60a1SPedro F. Giffuniis running then restart it.
1993f2a60a1SPedro F. GiffuniIf the service does not exist or is not running then zero is returned,
2003f2a60a1SPedro F. Giffuniotherwise the result of restarting the service.
201587392a5SHajimu UMEMOTO.It Fl v
202587392a5SHajimu UMEMOTOEcho variables DOMAINS, SEARCH and NAMESERVERS so that the subscriber can
203587392a5SHajimu UMEMOTOconfigure the resolver easily.
204d7149f4eSGlen Barber.It Fl V
205d7149f4eSGlen BarberSame as
206d7149f4eSGlen Barber.Fl v
207d7149f4eSGlen Barberexcept that only the information configured in
208d7149f4eSGlen Barber.Xr resolvconf.conf 5
209d7149f4eSGlen Barberis set.
210587392a5SHajimu UMEMOTO.El
211587392a5SHajimu UMEMOTO.Sh INTERFACE ORDERING
212587392a5SHajimu UMEMOTOFor
213587392a5SHajimu UMEMOTO.Nm
214587392a5SHajimu UMEMOTOto work effectively, it has to process the resolv.confs for the interfaces
215587392a5SHajimu UMEMOTOin the correct order.
216587392a5SHajimu UMEMOTO.Nm
217587392a5SHajimu UMEMOTOfirst processes interfaces from the
218587392a5SHajimu UMEMOTO.Sy interface_order
219587392a5SHajimu UMEMOTOlist, then interfaces without a metic and that match the
220587392a5SHajimu UMEMOTO.Sy dynamic_order
221587392a5SHajimu UMEMOTOlist, then interfaces with a metric in order and finally the rest in
222587392a5SHajimu UMEMOTOthe operating systems lexical order.
223587392a5SHajimu UMEMOTOSee
224587392a5SHajimu UMEMOTO.Xr resolvconf.conf 5
225587392a5SHajimu UMEMOTOfor details on these lists.
226d7149f4eSGlen Barber.Sh PROTOCOLS
227d7149f4eSGlen BarberHere are some suggested protocol tags to use for each
228d7149f4eSGlen Barber.Pa resolv.conf
229d7149f4eSGlen Barberfile registered on an
230d7149f4eSGlen Barber.Ar interface Ns No :-
231*87b2cfceSPedro F. Giffuni.Bl -tag -width pattern_opt
232d7149f4eSGlen Barber.It dhcp
233d7149f4eSGlen BarberDynamic Host Configuration Protocol.
234d7149f4eSGlen BarberInitial versions of
235d7149f4eSGlen Barber.Nm
236d7149f4eSGlen Barberdid not recommend a
237d7149f4eSGlen Barber.Ar protocol
238d7149f4eSGlen Barbertag be appended to the
239d7149f4eSGlen Barber.Ar interface
240d7149f4eSGlen Barbername.
241d7149f4eSGlen BarberWhen the protocol is absent, it is assumed to be the DHCP protocol.
242d7149f4eSGlen Barber.It ppp
243d7149f4eSGlen BarberPoint-to-Point Protocol.
244d7149f4eSGlen Barber.It ra
245d7149f4eSGlen BarberIPv6 Router Advertisement.
246d7149f4eSGlen Barber.It dhcp6
247d7149f4eSGlen BarberDynamic Host Configuration Protocol, version 6.
248d7149f4eSGlen Barber.El
249587392a5SHajimu UMEMOTO.Sh IMPLEMENTATION NOTES
250587392a5SHajimu UMEMOTOIf a subscriber has the executable bit then it is executed otherwise it is
251587392a5SHajimu UMEMOTOassumed to be a shell script and sourced into the current environment in a
252587392a5SHajimu UMEMOTOsubshell.
253587392a5SHajimu UMEMOTOThis is done so that subscribers can remain fast, but are also not limited
254587392a5SHajimu UMEMOTOto the shell language.
255587392a5SHajimu UMEMOTO.Pp
256587392a5SHajimu UMEMOTOPortable subscribers should not use anything outside of
257587392a5SHajimu UMEMOTO.Pa /bin
258587392a5SHajimu UMEMOTOand
259587392a5SHajimu UMEMOTO.Pa /sbin
260587392a5SHajimu UMEMOTObecause
261587392a5SHajimu UMEMOTO.Pa /usr
262587392a5SHajimu UMEMOTOand others may not be available when booting.
263587392a5SHajimu UMEMOTOAlso, it would be unwise to assume any shell specific features.
264587392a5SHajimu UMEMOTO.Sh ENVIRONMENT
265587392a5SHajimu UMEMOTO.Bl -ohang
266587392a5SHajimu UMEMOTO.It Va IF_METRIC
267587392a5SHajimu UMEMOTOIf the
268587392a5SHajimu UMEMOTO.Fl m
269587392a5SHajimu UMEMOTOoption is not present then we use
270587392a5SHajimu UMEMOTO.Va IF_METRIC
271587392a5SHajimu UMEMOTOfor the metric.
272587392a5SHajimu UMEMOTO.It Va IF_PRIVATE
273587392a5SHajimu UMEMOTOMarks the interface
274587392a5SHajimu UMEMOTO.Pa resolv.conf
275587392a5SHajimu UMEMOTOas private.
276d7149f4eSGlen Barber.It Va IF_EXCLUSIVE
277d7149f4eSGlen BarberMarks the interface
278d7149f4eSGlen Barber.Pa resolv.conf
279d7149f4eSGlen Barberas exclusive.
280587392a5SHajimu UMEMOTO.El
281587392a5SHajimu UMEMOTO.Sh FILES
282587392a5SHajimu UMEMOTO.Bl -ohang
283d7149f4eSGlen Barber.It Pa /etc/resolv.conf.bak
284d7149f4eSGlen BarberBackup file of the original resolv.conf.
285587392a5SHajimu UMEMOTO.It Pa @SYSCONFDIR@/resolvconf.conf
286587392a5SHajimu UMEMOTOConfiguration file for
287587392a5SHajimu UMEMOTO.Nm .
288587392a5SHajimu UMEMOTO.It Pa @LIBEXECDIR@
289587392a5SHajimu UMEMOTODirectory of subscribers which are run every time
290587392a5SHajimu UMEMOTO.Nm
291587392a5SHajimu UMEMOTOadds, deletes or updates.
292587392a5SHajimu UMEMOTO.It Pa @LIBEXECDIR@/libc.d
293587392a5SHajimu UMEMOTODirectory of subscribers which are run after the libc subscriber is run.
294587392a5SHajimu UMEMOTO.It Pa @VARDIR@
295587392a5SHajimu UMEMOTOState directory for
296587392a5SHajimu UMEMOTO.Nm .
297587392a5SHajimu UMEMOTO.El
2983f2a60a1SPedro F. Giffuni.Sh SEE ALSO
2993f2a60a1SPedro F. Giffuni.Xr resolver 3 ,
3003f2a60a1SPedro F. Giffuni.Xr stdin 4 ,
3013f2a60a1SPedro F. Giffuni.Xr resolv.conf 5 ,
3023f2a60a1SPedro F. Giffuni.Xr resolvconf.conf 5
303587392a5SHajimu UMEMOTO.Sh HISTORY
304587392a5SHajimu UMEMOTOThis implementation of
305587392a5SHajimu UMEMOTO.Nm
306587392a5SHajimu UMEMOTOis called openresolv and is fully command line compatible with Debian's
307587392a5SHajimu UMEMOTOresolvconf, as written by Thomas Hood.
308d7149f4eSGlen Barber.Sh AUTHORS
309d7149f4eSGlen Barber.An Roy Marples Aq Mt roy@marples.name
310587392a5SHajimu UMEMOTO.Sh BUGS
311d7149f4eSGlen BarberPlease report them to
312d7149f4eSGlen Barber.Lk http://roy.marples.name/projects/openresolv
313d7149f4eSGlen Barber.Pp
314587392a5SHajimu UMEMOTO.Nm
315587392a5SHajimu UMEMOTOdoes not validate any of the files given to it.
316587392a5SHajimu UMEMOTO.Pp
317587392a5SHajimu UMEMOTOWhen running a local resolver other than libc, you will need to configure it
318587392a5SHajimu UMEMOTOto include files that
319587392a5SHajimu UMEMOTO.Nm
320587392a5SHajimu UMEMOTOwill generate.
321587392a5SHajimu UMEMOTOYou should consult
322587392a5SHajimu UMEMOTO.Xr resolvconf.conf 5
323587392a5SHajimu UMEMOTOfor instructions on how to configure your resolver.
324