xref: /freebsd/contrib/openresolv/resolvconf.8.in (revision 3f2a60a1371a69d7e9caac43bf457b6f89cdfd48)
1*3f2a60a1SPedro 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*3f2a60a1SPedro F. Giffuni.Dd May 7, 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
48587392a5SHajimu UMEMOTO.Sh DESCRIPTION
49587392a5SHajimu UMEMOTO.Nm
50587392a5SHajimu UMEMOTOmanages
51587392a5SHajimu UMEMOTO.Xr resolv.conf 5
52587392a5SHajimu UMEMOTOfiles from multiple sources, such as DHCP and VPN clients.
53587392a5SHajimu UMEMOTOTraditionally, the host runs just one client and that updates
54587392a5SHajimu UMEMOTO.Pa /etc/resolv.conf .
55587392a5SHajimu UMEMOTOMore modern systems frequently have wired and wireless interfaces and there is
56587392a5SHajimu UMEMOTOno guarantee both are on the same network.
57587392a5SHajimu UMEMOTOWith the advent of VPN and other
58587392a5SHajimu UMEMOTOtypes of networking daemons, many things now contend for the contents of
59587392a5SHajimu UMEMOTO.Pa /etc/resolv.conf .
60587392a5SHajimu UMEMOTO.Pp
61587392a5SHajimu UMEMOTO.Nm
62587392a5SHajimu UMEMOTOsolves this by letting the daemon send their
63587392a5SHajimu UMEMOTO.Xr resolv.conf 5
64587392a5SHajimu UMEMOTOfile to
65587392a5SHajimu UMEMOTO.Nm
66587392a5SHajimu UMEMOTOvia
67*3f2a60a1SPedro F. Giffuni.Xr stdin 4
68587392a5SHajimu UMEMOTOwith the argument
69d7149f4eSGlen Barber.Fl a Ar interface Ns Op Ar .protocol
70587392a5SHajimu UMEMOTOinstead of the filesystem.
71587392a5SHajimu UMEMOTO.Nm
72587392a5SHajimu UMEMOTOthen updates
73587392a5SHajimu UMEMOTO.Pa /etc/resolv.conf
74587392a5SHajimu UMEMOTOas it thinks best.
75587392a5SHajimu UMEMOTOWhen a local resolver other than libc is installed, such as
76587392a5SHajimu UMEMOTO.Xr dnsmasq 8
77587392a5SHajimu UMEMOTOor
78587392a5SHajimu UMEMOTO.Xr named 8 ,
79587392a5SHajimu UMEMOTOthen
80587392a5SHajimu UMEMOTO.Nm
81587392a5SHajimu UMEMOTOwill supply files that the resolver should be configured to include.
82587392a5SHajimu UMEMOTO.Pp
83587392a5SHajimu UMEMOTO.Nm
84d7149f4eSGlen Barberassumes it has a job to do.
85d7149f4eSGlen BarberIn some situations
86d7149f4eSGlen Barber.Nm
87d7149f4eSGlen Barberneeds to act as a deterrent to writing to
88d7149f4eSGlen Barber.Pa /etc/resolv.conf .
89d7149f4eSGlen BarberWhere this file cannot be made immutable or you just need to toggle this
90d7149f4eSGlen Barberbehaviour,
91d7149f4eSGlen Barber.Nm
92d7149f4eSGlen Barbercan be disabled by adding
93d7149f4eSGlen Barber.Sy resolvconf Ns = Ns NO
94d7149f4eSGlen Barberto
95d7149f4eSGlen Barber.Xr resolvconf.conf 5 .
96d7149f4eSGlen Barber.Pp
97d7149f4eSGlen Barber.Nm
98587392a5SHajimu UMEMOTOcan mark an interfaces
99587392a5SHajimu UMEMOTO.Pa resolv.conf
100587392a5SHajimu UMEMOTOas private.
101587392a5SHajimu UMEMOTOThis means that the name servers listed in that
102587392a5SHajimu UMEMOTO.Pa resolv.conf
103587392a5SHajimu UMEMOTOare only used for queries against the domain/search listed in the same file.
104587392a5SHajimu UMEMOTOThis only works when a local resolver other than libc is installed.
105587392a5SHajimu UMEMOTOSee
106587392a5SHajimu UMEMOTO.Xr resolvconf.conf 5
107587392a5SHajimu UMEMOTOfor how to configure
108587392a5SHajimu UMEMOTO.Nm
109587392a5SHajimu UMEMOTOto use a local name server.
110587392a5SHajimu UMEMOTO.Pp
111d7149f4eSGlen Barber.Nm
112d7149f4eSGlen Barbercan mark an interfaces
113d7149f4eSGlen Barber.Pa resolv.conf
114d7149f4eSGlen Barberas exclusive.
115d7149f4eSGlen BarberOnly the latest exclusive interface is used for processing, otherwise all are.
116d7149f4eSGlen Barber.Pp
117587392a5SHajimu UMEMOTOWhen an interface goes down, it should then call
118587392a5SHajimu UMEMOTO.Nm
119587392a5SHajimu UMEMOTOwith
120d7149f4eSGlen Barber.Fl d Ar interface.*
121587392a5SHajimu UMEMOTOarguments to delete the
122587392a5SHajimu UMEMOTO.Pa resolv.conf
123d7149f4eSGlen Barberfile(s) for all the
124d7149f4eSGlen Barber.Ar protocols
125d7149f4eSGlen Barberon the
126587392a5SHajimu UMEMOTO.Ar interface .
127587392a5SHajimu UMEMOTO.Pp
128*3f2a60a1SPedro F. GiffuniHere are some options for the above commands:-
129587392a5SHajimu UMEMOTO.Bl -tag -width indent
130587392a5SHajimu UMEMOTO.It Fl f
131*3f2a60a1SPedro F. GiffuniIgnore non existent interfaces.
132587392a5SHajimu UMEMOTOOnly really useful for deleting interfaces.
133*3f2a60a1SPedro F. Giffuni.It Fl m Ar metric
134*3f2a60a1SPedro F. GiffuniSet the metric of the interface when adding it, default of 0.
135*3f2a60a1SPedro F. GiffuniLower metrics take precedence.
136*3f2a60a1SPedro F. GiffuniThis affects the default order of interfaces when listed.
137*3f2a60a1SPedro F. Giffuni.It Fl p
138*3f2a60a1SPedro F. GiffuniMarks the interface
139*3f2a60a1SPedro F. Giffuni.Pa resolv.conf
140*3f2a60a1SPedro F. Giffunias private.
141*3f2a60a1SPedro F. Giffuni.It Fl x
142*3f2a60a1SPedro F. GiffuniMark the interface
143*3f2a60a1SPedro F. Giffuni.Pa resolv.conf
144*3f2a60a1SPedro F. Giffunias exclusive when adding, otherwise only use the latest exclusive interface.
145*3f2a60a1SPedro F. Giffuni.El
146*3f2a60a1SPedro F. Giffuni.Pp
147*3f2a60a1SPedro F. Giffuni.Nm
148*3f2a60a1SPedro F. Giffunihas some more commands for general usage:-
149*3f2a60a1SPedro F. Giffuni.Bl -tag -width indent
150587392a5SHajimu UMEMOTO.It Fl i Ar pattern
151d7149f4eSGlen BarberList the interfaces and protocols, optionally matching
152587392a5SHajimu UMEMOTO.Ar pattern ,
153587392a5SHajimu UMEMOTOwe have
154587392a5SHajimu UMEMOTO.Pa resolv.conf
155587392a5SHajimu UMEMOTOfiles for.
156587392a5SHajimu UMEMOTO.It Fl l Ar pattern
157587392a5SHajimu UMEMOTOList the
158587392a5SHajimu UMEMOTO.Pa resolv.conf
159587392a5SHajimu UMEMOTOfiles we have.
160587392a5SHajimu UMEMOTOIf
161587392a5SHajimu UMEMOTO.Ar pattern
162d7149f4eSGlen Barberis specified then we list the files for the interfaces and protocols
163d7149f4eSGlen Barberthat match it.
164587392a5SHajimu UMEMOTO.It Fl u
165587392a5SHajimu UMEMOTOForce
166587392a5SHajimu UMEMOTO.Nm
167d7149f4eSGlen Barberto update all its subscribers.
168587392a5SHajimu UMEMOTO.Nm
169587392a5SHajimu UMEMOTOdoes not update the subscribers when adding a resolv.conf that matches
170587392a5SHajimu UMEMOTOwhat it already has for that interface.
171587392a5SHajimu UMEMOTO.El
172587392a5SHajimu UMEMOTO.Pp
173587392a5SHajimu UMEMOTO.Nm
174*3f2a60a1SPedro F. Giffunialso has some commands designed to be used by it's subscribers and
175*3f2a60a1SPedro F. Giffunisystem startup:-
176587392a5SHajimu UMEMOTO.Bl -tag -width indent
177*3f2a60a1SPedro F. Giffuni.It Fl I
178*3f2a60a1SPedro F. GiffuniInitialise the state directory
179*3f2a60a1SPedro F. Giffuni.Pa @VARDIR@ .
180*3f2a60a1SPedro F. GiffuniThis only needs to be called if the initial system boot sequence does not
181*3f2a60a1SPedro F. Giffuniautomatically clean it out; for example the state directory is moved
182*3f2a60a1SPedro F. Giffunisomewhere other than
183*3f2a60a1SPedro F. Giffuni.Pa /var/run .
184*3f2a60a1SPedro F. GiffuniIf used, it should only be called once as early in the system boot sequence
185*3f2a60a1SPedro F. Giffunias possible and before
186*3f2a60a1SPedro F. Giffuni.Nm
187*3f2a60a1SPedro F. Giffuniis used to add interfaces.
188*3f2a60a1SPedro F. Giffuni.It Fl R
189*3f2a60a1SPedro F. GiffuniEcho the command used to restart a service.
190*3f2a60a1SPedro F. Giffuni.It Fl r Ar service
191*3f2a60a1SPedro F. GiffuniIf the
192*3f2a60a1SPedro F. Giffuni.Ar service
193*3f2a60a1SPedro F. Giffuniis running then restart it.
194*3f2a60a1SPedro F. GiffuniIf the service does not exist or is not running then zero is returned,
195*3f2a60a1SPedro F. Giffuniotherwise the result of restarting the service.
196587392a5SHajimu UMEMOTO.It Fl v
197587392a5SHajimu UMEMOTOEcho variables DOMAINS, SEARCH and NAMESERVERS so that the subscriber can
198587392a5SHajimu UMEMOTOconfigure the resolver easily.
199d7149f4eSGlen Barber.It Fl V
200d7149f4eSGlen BarberSame as
201d7149f4eSGlen Barber.Fl v
202d7149f4eSGlen Barberexcept that only the information configured in
203d7149f4eSGlen Barber.Xr resolvconf.conf 5
204d7149f4eSGlen Barberis set.
205587392a5SHajimu UMEMOTO.El
206587392a5SHajimu UMEMOTO.Sh INTERFACE ORDERING
207587392a5SHajimu UMEMOTOFor
208587392a5SHajimu UMEMOTO.Nm
209587392a5SHajimu UMEMOTOto work effectively, it has to process the resolv.confs for the interfaces
210587392a5SHajimu UMEMOTOin the correct order.
211587392a5SHajimu UMEMOTO.Nm
212587392a5SHajimu UMEMOTOfirst processes interfaces from the
213587392a5SHajimu UMEMOTO.Sy interface_order
214587392a5SHajimu UMEMOTOlist, then interfaces without a metic and that match the
215587392a5SHajimu UMEMOTO.Sy dynamic_order
216587392a5SHajimu UMEMOTOlist, then interfaces with a metric in order and finally the rest in
217587392a5SHajimu UMEMOTOthe operating systems lexical order.
218587392a5SHajimu UMEMOTOSee
219587392a5SHajimu UMEMOTO.Xr resolvconf.conf 5
220587392a5SHajimu UMEMOTOfor details on these lists.
221d7149f4eSGlen Barber.Sh PROTOCOLS
222d7149f4eSGlen BarberHere are some suggested protocol tags to use for each
223d7149f4eSGlen Barber.Pa resolv.conf
224d7149f4eSGlen Barberfile registered on an
225d7149f4eSGlen Barber.Ar interface Ns No :-
226d7149f4eSGlen Barber.Bl -tag -width indent
227d7149f4eSGlen Barber.It dhcp
228d7149f4eSGlen BarberDynamic Host Configuration Protocol.
229d7149f4eSGlen BarberInitial versions of
230d7149f4eSGlen Barber.Nm
231d7149f4eSGlen Barberdid not recommend a
232d7149f4eSGlen Barber.Ar protocol
233d7149f4eSGlen Barbertag be appended to the
234d7149f4eSGlen Barber.Ar interface
235d7149f4eSGlen Barbername.
236d7149f4eSGlen BarberWhen the protocol is absent, it is assumed to be the DHCP protocol.
237d7149f4eSGlen Barber.It ppp
238d7149f4eSGlen BarberPoint-to-Point Protocol.
239d7149f4eSGlen Barber.It ra
240d7149f4eSGlen BarberIPv6 Router Advertisement.
241d7149f4eSGlen Barber.It dhcp6
242d7149f4eSGlen BarberDynamic Host Configuration Protocol, version 6.
243d7149f4eSGlen Barber.El
244587392a5SHajimu UMEMOTO.Sh IMPLEMENTATION NOTES
245587392a5SHajimu UMEMOTOIf a subscriber has the executable bit then it is executed otherwise it is
246587392a5SHajimu UMEMOTOassumed to be a shell script and sourced into the current environment in a
247587392a5SHajimu UMEMOTOsubshell.
248587392a5SHajimu UMEMOTOThis is done so that subscribers can remain fast, but are also not limited
249587392a5SHajimu UMEMOTOto the shell language.
250587392a5SHajimu UMEMOTO.Pp
251587392a5SHajimu UMEMOTOPortable subscribers should not use anything outside of
252587392a5SHajimu UMEMOTO.Pa /bin
253587392a5SHajimu UMEMOTOand
254587392a5SHajimu UMEMOTO.Pa /sbin
255587392a5SHajimu UMEMOTObecause
256587392a5SHajimu UMEMOTO.Pa /usr
257587392a5SHajimu UMEMOTOand others may not be available when booting.
258587392a5SHajimu UMEMOTOAlso, it would be unwise to assume any shell specific features.
259587392a5SHajimu UMEMOTO.Sh ENVIRONMENT
260587392a5SHajimu UMEMOTO.Bl -ohang
261587392a5SHajimu UMEMOTO.It Va IF_METRIC
262587392a5SHajimu UMEMOTOIf the
263587392a5SHajimu UMEMOTO.Fl m
264587392a5SHajimu UMEMOTOoption is not present then we use
265587392a5SHajimu UMEMOTO.Va IF_METRIC
266587392a5SHajimu UMEMOTOfor the metric.
267587392a5SHajimu UMEMOTO.It Va IF_PRIVATE
268587392a5SHajimu UMEMOTOMarks the interface
269587392a5SHajimu UMEMOTO.Pa resolv.conf
270587392a5SHajimu UMEMOTOas private.
271d7149f4eSGlen Barber.It Va IF_EXCLUSIVE
272d7149f4eSGlen BarberMarks the interface
273d7149f4eSGlen Barber.Pa resolv.conf
274d7149f4eSGlen Barberas exclusive.
275587392a5SHajimu UMEMOTO.El
276587392a5SHajimu UMEMOTO.Sh FILES
277587392a5SHajimu UMEMOTO.Bl -ohang
278d7149f4eSGlen Barber.It Pa /etc/resolv.conf.bak
279d7149f4eSGlen BarberBackup file of the original resolv.conf.
280587392a5SHajimu UMEMOTO.It Pa @SYSCONFDIR@/resolvconf.conf
281587392a5SHajimu UMEMOTOConfiguration file for
282587392a5SHajimu UMEMOTO.Nm .
283587392a5SHajimu UMEMOTO.It Pa @LIBEXECDIR@
284587392a5SHajimu UMEMOTODirectory of subscribers which are run every time
285587392a5SHajimu UMEMOTO.Nm
286587392a5SHajimu UMEMOTOadds, deletes or updates.
287587392a5SHajimu UMEMOTO.It Pa @LIBEXECDIR@/libc.d
288587392a5SHajimu UMEMOTODirectory of subscribers which are run after the libc subscriber is run.
289587392a5SHajimu UMEMOTO.It Pa @VARDIR@
290587392a5SHajimu UMEMOTOState directory for
291587392a5SHajimu UMEMOTO.Nm .
292587392a5SHajimu UMEMOTO.El
293*3f2a60a1SPedro F. Giffuni.Sh SEE ALSO
294*3f2a60a1SPedro F. Giffuni.Xr resolver 3 ,
295*3f2a60a1SPedro F. Giffuni.Xr stdin 4 ,
296*3f2a60a1SPedro F. Giffuni.Xr resolv.conf 5 ,
297*3f2a60a1SPedro F. Giffuni.Xr resolvconf.conf 5
298587392a5SHajimu UMEMOTO.Sh HISTORY
299587392a5SHajimu UMEMOTOThis implementation of
300587392a5SHajimu UMEMOTO.Nm
301587392a5SHajimu UMEMOTOis called openresolv and is fully command line compatible with Debian's
302587392a5SHajimu UMEMOTOresolvconf, as written by Thomas Hood.
303d7149f4eSGlen Barber.Sh AUTHORS
304d7149f4eSGlen Barber.An Roy Marples Aq Mt roy@marples.name
305587392a5SHajimu UMEMOTO.Sh BUGS
306d7149f4eSGlen BarberPlease report them to
307d7149f4eSGlen Barber.Lk http://roy.marples.name/projects/openresolv
308d7149f4eSGlen Barber.Pp
309587392a5SHajimu UMEMOTO.Nm
310587392a5SHajimu UMEMOTOdoes not validate any of the files given to it.
311587392a5SHajimu UMEMOTO.Pp
312587392a5SHajimu UMEMOTOWhen running a local resolver other than libc, you will need to configure it
313587392a5SHajimu UMEMOTOto include files that
314587392a5SHajimu UMEMOTO.Nm
315587392a5SHajimu UMEMOTOwill generate.
316587392a5SHajimu UMEMOTOYou should consult
317587392a5SHajimu UMEMOTO.Xr resolvconf.conf 5
318587392a5SHajimu UMEMOTOfor instructions on how to configure your resolver.
319