1*d7149f4eSGlen Barber.\" Copyright (c) 2007-2015 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*d7149f4eSGlen Barber.Dd April 27, 2014 26*d7149f4eSGlen 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 37*d7149f4eSGlen Barber.Op Fl x 38*d7149f4eSGlen Barber.Fl a Ar interface Ns Op Ar .protocol 39*d7149f4eSGlen Barber.No < Ns Pa file 40587392a5SHajimu UMEMOTO.Nm 41587392a5SHajimu UMEMOTO.Op Fl f 42*d7149f4eSGlen Barber.Fl d Ar interface Ns Op Ar .protocol 43587392a5SHajimu UMEMOTO.Nm 44*d7149f4eSGlen 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 67587392a5SHajimu UMEMOTO.Xr stdin 3 68587392a5SHajimu UMEMOTOwith the argument 69*d7149f4eSGlen 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 84*d7149f4eSGlen Barberassumes it has a job to do. 85*d7149f4eSGlen BarberIn some situations 86*d7149f4eSGlen Barber.Nm 87*d7149f4eSGlen Barberneeds to act as a deterrent to writing to 88*d7149f4eSGlen Barber.Pa /etc/resolv.conf . 89*d7149f4eSGlen BarberWhere this file cannot be made immutable or you just need to toggle this 90*d7149f4eSGlen Barberbehaviour, 91*d7149f4eSGlen Barber.Nm 92*d7149f4eSGlen Barbercan be disabled by adding 93*d7149f4eSGlen Barber.Sy resolvconf Ns = Ns NO 94*d7149f4eSGlen Barberto 95*d7149f4eSGlen Barber.Xr resolvconf.conf 5 . 96*d7149f4eSGlen Barber.Pp 97*d7149f4eSGlen 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 111*d7149f4eSGlen Barber.Nm 112*d7149f4eSGlen Barbercan mark an interfaces 113*d7149f4eSGlen Barber.Pa resolv.conf 114*d7149f4eSGlen Barberas exclusive. 115*d7149f4eSGlen BarberOnly the latest exclusive interface is used for processing, otherwise all are. 116*d7149f4eSGlen Barber.Pp 117587392a5SHajimu UMEMOTOWhen an interface goes down, it should then call 118587392a5SHajimu UMEMOTO.Nm 119587392a5SHajimu UMEMOTOwith 120*d7149f4eSGlen Barber.Fl d Ar interface.* 121587392a5SHajimu UMEMOTOarguments to delete the 122587392a5SHajimu UMEMOTO.Pa resolv.conf 123*d7149f4eSGlen Barberfile(s) for all the 124*d7149f4eSGlen Barber.Ar protocols 125*d7149f4eSGlen Barberon the 126587392a5SHajimu UMEMOTO.Ar interface . 127587392a5SHajimu UMEMOTO.Pp 128587392a5SHajimu UMEMOTOHere are some more options that 129587392a5SHajimu UMEMOTO.Nm 130587392a5SHajimu UMEMOTOhas:- 131587392a5SHajimu UMEMOTO.Bl -tag -width indent 132587392a5SHajimu UMEMOTO.It Fl I 133587392a5SHajimu UMEMOTOInitialise the state directory 134587392a5SHajimu UMEMOTO.Pa @VARDIR@ . 135587392a5SHajimu UMEMOTOThis only needs to be called if the initial system boot sequence does not 136587392a5SHajimu UMEMOTOautomatically clean it out; for example the state directory is moved 137587392a5SHajimu UMEMOTOsomewhere other than 138587392a5SHajimu UMEMOTO.Pa /var/run . 139587392a5SHajimu UMEMOTOIf used, it should only be called once as early in the system boot sequence 140587392a5SHajimu UMEMOTOas possible and before 141587392a5SHajimu UMEMOTO.Nm 142587392a5SHajimu UMEMOTOis used to add interfaces. 143587392a5SHajimu UMEMOTO.It Fl f 144587392a5SHajimu UMEMOTOIgnore non existant interfaces. 145587392a5SHajimu UMEMOTOOnly really useful for deleting interfaces. 146587392a5SHajimu UMEMOTO.It Fl i Ar pattern 147*d7149f4eSGlen BarberList the interfaces and protocols, optionally matching 148587392a5SHajimu UMEMOTO.Ar pattern , 149587392a5SHajimu UMEMOTOwe have 150587392a5SHajimu UMEMOTO.Pa resolv.conf 151587392a5SHajimu UMEMOTOfiles for. 152587392a5SHajimu UMEMOTO.It Fl l Ar pattern 153587392a5SHajimu UMEMOTOList the 154587392a5SHajimu UMEMOTO.Pa resolv.conf 155587392a5SHajimu UMEMOTOfiles we have. 156587392a5SHajimu UMEMOTOIf 157587392a5SHajimu UMEMOTO.Ar pattern 158*d7149f4eSGlen Barberis specified then we list the files for the interfaces and protocols 159*d7149f4eSGlen Barberthat match it. 160587392a5SHajimu UMEMOTO.It Fl m Ar metric 161587392a5SHajimu UMEMOTOSet the metric of the interface when adding it, default of 0. 162587392a5SHajimu UMEMOTOLower metrics take precedence. 163587392a5SHajimu UMEMOTOThis affects the default order of interfaces when listed. 164587392a5SHajimu UMEMOTO.It Fl p 165587392a5SHajimu UMEMOTOMarks the interface 166587392a5SHajimu UMEMOTO.Pa resolv.conf 167587392a5SHajimu UMEMOTOas private. 168587392a5SHajimu UMEMOTO.It Fl u 169587392a5SHajimu UMEMOTOForce 170587392a5SHajimu UMEMOTO.Nm 171*d7149f4eSGlen Barberto update all its subscribers. 172587392a5SHajimu UMEMOTO.Nm 173587392a5SHajimu UMEMOTOdoes not update the subscribers when adding a resolv.conf that matches 174587392a5SHajimu UMEMOTOwhat it already has for that interface. 175*d7149f4eSGlen Barber.It Fl x 176*d7149f4eSGlen BarberMark the interface 177*d7149f4eSGlen Barber.Pa resolv.conf 178*d7149f4eSGlen Barberas exclusive when adding, otherwise only use the latest exclusive interface. 179587392a5SHajimu UMEMOTO.El 180587392a5SHajimu UMEMOTO.Pp 181587392a5SHajimu UMEMOTO.Nm 182*d7149f4eSGlen Barberalso has some options designed to be used by its subscribers:- 183587392a5SHajimu UMEMOTO.Bl -tag -width indent 184587392a5SHajimu UMEMOTO.It Fl v 185587392a5SHajimu UMEMOTOEcho variables DOMAINS, SEARCH and NAMESERVERS so that the subscriber can 186587392a5SHajimu UMEMOTOconfigure the resolver easily. 187*d7149f4eSGlen Barber.It Fl V 188*d7149f4eSGlen BarberSame as 189*d7149f4eSGlen Barber.Fl v 190*d7149f4eSGlen Barberexcept that only the information configured in 191*d7149f4eSGlen Barber.Xr resolvconf.conf 5 192*d7149f4eSGlen Barberis set. 193587392a5SHajimu UMEMOTO.El 194587392a5SHajimu UMEMOTO.Sh INTERFACE ORDERING 195587392a5SHajimu UMEMOTOFor 196587392a5SHajimu UMEMOTO.Nm 197587392a5SHajimu UMEMOTOto work effectively, it has to process the resolv.confs for the interfaces 198587392a5SHajimu UMEMOTOin the correct order. 199587392a5SHajimu UMEMOTO.Nm 200587392a5SHajimu UMEMOTOfirst processes interfaces from the 201587392a5SHajimu UMEMOTO.Sy interface_order 202587392a5SHajimu UMEMOTOlist, then interfaces without a metic and that match the 203587392a5SHajimu UMEMOTO.Sy dynamic_order 204587392a5SHajimu UMEMOTOlist, then interfaces with a metric in order and finally the rest in 205587392a5SHajimu UMEMOTOthe operating systems lexical order. 206587392a5SHajimu UMEMOTOSee 207587392a5SHajimu UMEMOTO.Xr resolvconf.conf 5 208587392a5SHajimu UMEMOTOfor details on these lists. 209*d7149f4eSGlen Barber.Sh PROTOCOLS 210*d7149f4eSGlen BarberHere are some suggested protocol tags to use for each 211*d7149f4eSGlen Barber.Pa resolv.conf 212*d7149f4eSGlen Barberfile registered on an 213*d7149f4eSGlen Barber.Ar interface Ns No :- 214*d7149f4eSGlen Barber.Bl -tag -width indent 215*d7149f4eSGlen Barber.It dhcp 216*d7149f4eSGlen BarberDynamic Host Configuration Protocol. 217*d7149f4eSGlen BarberInitial versions of 218*d7149f4eSGlen Barber.Nm 219*d7149f4eSGlen Barberdid not recommend a 220*d7149f4eSGlen Barber.Ar protocol 221*d7149f4eSGlen Barbertag be appended to the 222*d7149f4eSGlen Barber.Ar interface 223*d7149f4eSGlen Barbername. 224*d7149f4eSGlen BarberWhen the protocol is absent, it is assumed to be the DHCP protocol. 225*d7149f4eSGlen Barber.It ppp 226*d7149f4eSGlen BarberPoint-to-Point Protocol. 227*d7149f4eSGlen Barber.It ra 228*d7149f4eSGlen BarberIPv6 Router Advertisement. 229*d7149f4eSGlen Barber.It dhcp6 230*d7149f4eSGlen BarberDynamic Host Configuration Protocol, version 6. 231*d7149f4eSGlen Barber.El 232587392a5SHajimu UMEMOTO.Sh IMPLEMENTATION NOTES 233587392a5SHajimu UMEMOTOIf a subscriber has the executable bit then it is executed otherwise it is 234587392a5SHajimu UMEMOTOassumed to be a shell script and sourced into the current environment in a 235587392a5SHajimu UMEMOTOsubshell. 236587392a5SHajimu UMEMOTOThis is done so that subscribers can remain fast, but are also not limited 237587392a5SHajimu UMEMOTOto the shell language. 238587392a5SHajimu UMEMOTO.Pp 239587392a5SHajimu UMEMOTOPortable subscribers should not use anything outside of 240587392a5SHajimu UMEMOTO.Pa /bin 241587392a5SHajimu UMEMOTOand 242587392a5SHajimu UMEMOTO.Pa /sbin 243587392a5SHajimu UMEMOTObecause 244587392a5SHajimu UMEMOTO.Pa /usr 245587392a5SHajimu UMEMOTOand others may not be available when booting. 246587392a5SHajimu UMEMOTOAlso, it would be unwise to assume any shell specific features. 247587392a5SHajimu UMEMOTO.Sh ENVIRONMENT 248587392a5SHajimu UMEMOTO.Bl -ohang 249587392a5SHajimu UMEMOTO.It Va IF_METRIC 250587392a5SHajimu UMEMOTOIf the 251587392a5SHajimu UMEMOTO.Fl m 252587392a5SHajimu UMEMOTOoption is not present then we use 253587392a5SHajimu UMEMOTO.Va IF_METRIC 254587392a5SHajimu UMEMOTOfor the metric. 255587392a5SHajimu UMEMOTO.It Va IF_PRIVATE 256587392a5SHajimu UMEMOTOMarks the interface 257587392a5SHajimu UMEMOTO.Pa resolv.conf 258587392a5SHajimu UMEMOTOas private. 259*d7149f4eSGlen Barber.It Va IF_EXCLUSIVE 260*d7149f4eSGlen BarberMarks the interface 261*d7149f4eSGlen Barber.Pa resolv.conf 262*d7149f4eSGlen Barberas exclusive. 263587392a5SHajimu UMEMOTO.El 264587392a5SHajimu UMEMOTO.Sh FILES 265587392a5SHajimu UMEMOTO.Bl -ohang 266*d7149f4eSGlen Barber.It Pa /etc/resolv.conf.bak 267*d7149f4eSGlen BarberBackup file of the original resolv.conf. 268587392a5SHajimu UMEMOTO.It Pa @SYSCONFDIR@/resolvconf.conf 269587392a5SHajimu UMEMOTOConfiguration file for 270587392a5SHajimu UMEMOTO.Nm . 271587392a5SHajimu UMEMOTO.It Pa @LIBEXECDIR@ 272587392a5SHajimu UMEMOTODirectory of subscribers which are run every time 273587392a5SHajimu UMEMOTO.Nm 274587392a5SHajimu UMEMOTOadds, deletes or updates. 275587392a5SHajimu UMEMOTO.It Pa @LIBEXECDIR@/libc.d 276587392a5SHajimu UMEMOTODirectory of subscribers which are run after the libc subscriber is run. 277587392a5SHajimu UMEMOTO.It Pa @VARDIR@ 278587392a5SHajimu UMEMOTOState directory for 279587392a5SHajimu UMEMOTO.Nm . 280587392a5SHajimu UMEMOTO.El 281587392a5SHajimu UMEMOTO.Sh HISTORY 282587392a5SHajimu UMEMOTOThis implementation of 283587392a5SHajimu UMEMOTO.Nm 284587392a5SHajimu UMEMOTOis called openresolv and is fully command line compatible with Debian's 285587392a5SHajimu UMEMOTOresolvconf, as written by Thomas Hood. 286*d7149f4eSGlen Barber.Sh SEE ALSO 287*d7149f4eSGlen Barber.Xr resolv.conf 5 , 288*d7149f4eSGlen Barber.Xr resolvconf.conf 5 , 289*d7149f4eSGlen Barber.Xr resolver 3 , 290*d7149f4eSGlen Barber.Xr stdin 3 291*d7149f4eSGlen Barber.Sh AUTHORS 292*d7149f4eSGlen Barber.An Roy Marples Aq Mt roy@marples.name 293587392a5SHajimu UMEMOTO.Sh BUGS 294*d7149f4eSGlen BarberPlease report them to 295*d7149f4eSGlen Barber.Lk http://roy.marples.name/projects/openresolv 296*d7149f4eSGlen Barber.Pp 297587392a5SHajimu UMEMOTO.Nm 298587392a5SHajimu UMEMOTOdoes not validate any of the files given to it. 299587392a5SHajimu UMEMOTO.Pp 300587392a5SHajimu UMEMOTOWhen running a local resolver other than libc, you will need to configure it 301587392a5SHajimu UMEMOTOto include files that 302587392a5SHajimu UMEMOTO.Nm 303587392a5SHajimu UMEMOTOwill generate. 304587392a5SHajimu UMEMOTOYou should consult 305587392a5SHajimu UMEMOTO.Xr resolvconf.conf 5 306587392a5SHajimu UMEMOTOfor instructions on how to configure your resolver. 307