1.\" Copyright (c) 2007-2025 Roy Marples 2.\" All rights reserved 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.Dd March 24, 2025 26.Dt RESOLVCONF 8 27.Os 28.Sh NAME 29.Nm resolvconf 30.Nd a framework for managing multiple DNS configurations 31.Sh SYNOPSIS 32.Nm 33.Fl I 34.Nm 35.Op Fl m Ar metric 36.Op Fl p 37.Op Fl x 38.Fl a Ar interface Ns Op Ar .protocol 39.No < Ns Pa file 40.Nm 41.Fl C Ar pattern 42.Nm 43.Fl c Ar pattern 44.Nm 45.Op Fl f 46.Fl d Ar interface Ns Op Ar .protocol 47.Nm 48.Op Fl x 49.Fl iLl Ar pattern 50.Nm 51.Fl u 52.Nm 53.Fl Fl version 54.Sh DESCRIPTION 55.Nm 56manages 57.Xr resolv.conf 5 58files from multiple sources, such as DHCP and VPN clients. 59Traditionally, the host runs just one client and that updates 60.Pa /etc/resolv.conf . 61More modern systems frequently have wired and wireless interfaces and there is 62no guarantee both are on the same network. 63With the advent of VPN and other 64types of networking daemons, many things now contend for the contents of 65.Pa /etc/resolv.conf . 66.Pp 67.Nm 68solves this by letting the daemon send their 69.Xr resolv.conf 5 70file to 71.Nm 72via 73.Xr stdin 4 74with the argument 75.Fl a Ar interface Ns Op Ar .protocol 76instead of the filesystem. 77.Nm 78then updates 79.Pa /etc/resolv.conf 80as it thinks best. 81When a local resolver other than libc is installed, such as 82.Xr dnsmasq 8 83or 84.Xr named 8 , 85then 86.Nm 87will supply files that the resolver should be configured to include. 88.Pp 89.Nm 90assumes it has a job to do. 91In some situations 92.Nm 93needs to act as a deterrent to writing to 94.Pa /etc/resolv.conf . 95Where this file cannot be made immutable or you just need to toggle this 96behaviour, 97.Nm 98can be disabled by adding 99.Sy resolvconf Ns = Ns NO 100to 101.Xr resolvconf.conf 5 . 102.Pp 103.Nm 104can mark an interfaces 105.Pa resolv.conf 106as private. 107This means that the name servers listed in that 108.Pa resolv.conf 109are only used for queries against the domain/search listed in the same file. 110This only works when a local resolver other than libc is installed. 111See 112.Xr resolvconf.conf 5 113for how to configure 114.Nm 115to use a local name server and how to remove the private marking. 116.Pp 117.Nm 118can mark an interfaces 119.Pa resolv.conf 120as exclusive. 121Only the latest exclusive interface is used for processing, otherwise all are. 122.Pp 123When an interface goes down, it should then call 124.Nm 125with 126.Fl d Ar interface.* 127arguments to delete the 128.Pa resolv.conf 129file(s) for all the 130.Ar protocols 131on the 132.Ar interface . 133For systems that support the concept of persisting configuration when 134the carrier goes down, then it should instead call 135.Nm 136with 137.Fl C Ar interface.* 138arguments to deprecate the matching interfaces and 139.Fl c Ar interface.* 140to activate the matching interfaces when the carrier comes up. 141This only affects the order in which interfaces are processed. 142.Pp 143Here are some options for the above commands:- 144.Bl -tag -width pattern_opt 145.It Fl f 146Ignore non existent interfaces. 147Only really useful for deleting interfaces. 148.It Fl m Ar metric 149Set the metric of the interface when adding it, default of 0. 150Lower metrics take precedence. 151This affects the default order of interfaces when listed. 152.It Fl p 153Marks the interface 154.Pa resolv.conf 155as private. 156.It Fl x 157Mark the interface 158.Pa resolv.conf 159as exclusive when adding, otherwise only use the latest exclusive interface. 160.El 161.Pp 162.Nm 163has some more commands for general usage:- 164.Bl -tag -width pattern_opt 165.It Fl i Ar pattern 166List the interfaces and protocols, optionally matching 167.Ar pattern , 168we have 169.Pa resolv.conf 170files for. 171.It Fl L Ar pattern 172List the 173.Pa resolv.conf 174files we have, 175post-processed by the 176.Xr resolvconf.conf 5 177configuration. 178If 179.Ar pattern 180is specified then we list the files for the interfaces and protocols 181that match it. 182.It Fl l Ar pattern 183List the 184.Pa resolv.conf 185files we have. 186If 187.Ar pattern 188is specified then we list the files for the interfaces and protocols 189that match it. 190.It Fl u 191Force 192.Nm 193to update all its subscribers. 194.Nm 195does not update the subscribers when adding a resolv.conf that matches 196what it already has for that interface. 197.It Fl Fl version 198Echo the resolvconf version to 199.Em stdout . 200.El 201.Pp 202.Nm 203also has some commands designed to be used by its subscribers and 204system startup:- 205.Bl -tag -width pattern_opt 206.It Fl I 207Initialise the state directory 208.Pa @VARDIR@ . 209This only needs to be called if the initial system boot sequence does not 210automatically clean it out; for example the state directory is moved 211somewhere other than 212.Pa /var/run . 213If used, it should only be called once as early in the system boot sequence 214as possible and before 215.Nm 216is used to add interfaces. 217.It Fl R 218Echo the command used to restart a service. 219.It Fl r Ar service 220If the 221.Ar service 222is running then restart it. 223If the service does not exist or is not running then zero is returned, 224otherwise the result of restarting the service. 225.It Fl v 226Echo variables DOMAINS, SEARCH and NAMESERVERS so that the subscriber can 227configure the resolver easily. 228.It Fl V 229Same as 230.Fl v 231except that only the information configured in 232.Xr resolvconf.conf 5 233is set. 234.El 235.Sh INTERFACE ORDERING 236For 237.Nm 238to work effectively, it has to process the resolv.confs for the interfaces 239in the correct order. 240.Nm 241first processes interfaces from the 242.Sy interface_order 243list, then interfaces without a metric and that match the 244.Sy dynamic_order 245list, then interfaces with a metric in order and finally the rest in 246the operating systems lexical order. 247See 248.Xr resolvconf.conf 5 249for details on these lists. 250.Sh PROTOCOLS 251Here are some suggested protocol tags to use for each 252.Pa resolv.conf 253file registered on an 254.Ar interface Ns No :- 255.Bl -tag -width pattern_opt 256.It dhcp 257Dynamic Host Configuration Protocol. 258Initial versions of 259.Nm 260did not recommend a 261.Ar protocol 262tag be appended to the 263.Ar interface 264name. 265When the protocol is absent, it is assumed to be the DHCP protocol. 266.It ppp 267Point-to-Point Protocol. 268.It ra 269IPv6 Router Advertisement. 270.It dhcp6 271Dynamic Host Configuration Protocol, version 6. 272.El 273.Sh IMPLEMENTATION NOTES 274If a subscriber has the executable bit then it is executed otherwise it is 275assumed to be a shell script and sourced into the current environment in a 276subshell. 277This is done so that subscribers can remain fast, but are also not limited 278to the shell language. 279.Pp 280Portable subscribers should not use anything outside of 281.Pa /bin 282and 283.Pa /sbin 284because 285.Pa /usr 286and others may not be available when booting. 287Also, it would be unwise to assume any shell specific features. 288.Sh ENVIRONMENT 289.Bl -ohang 290.It Va IF_METRIC 291If the 292.Fl m 293option is not present then we use 294.Va IF_METRIC 295for the metric. 296.It Va IF_PRIVATE 297Marks the interface 298.Pa resolv.conf 299as private. 300.It Va IF_EXCLUSIVE 301Marks the interface 302.Pa resolv.conf 303as exclusive. 304.El 305.Sh FILES 306.Bl -ohang 307.It Pa /etc/resolv.conf.bak 308Backup file of the original resolv.conf. 309.It Pa @SYSCONFDIR@/resolvconf.conf 310Configuration file for 311.Nm . 312.It Pa @LIBEXECDIR@ 313Directory of subscribers which are run every time 314.Nm 315adds, deletes or updates. 316.It Pa @LIBEXECDIR@/libc.d 317Directory of subscribers which are run after the libc subscriber is run. 318.It Pa @VARDIR@ 319State directory for 320.Nm . 321.El 322.Sh SEE ALSO 323.Xr resolver 3 , 324.Xr stdin 4 , 325.Xr resolv.conf 5 , 326.Xr resolvconf.conf 5 327.Sh HISTORY 328This implementation of 329.Nm 330is called openresolv and is fully command line compatible with Debian's 331resolvconf, as written by Thomas Hood. 332.Sh AUTHORS 333.An Roy Marples Aq Mt roy@marples.name 334.Sh BUGS 335Please report them to 336.Lk http://roy.marples.name/projects/openresolv 337.Pp 338.Nm 339does not validate any of the files given to it. 340.Pp 341When running a local resolver other than libc, you will need to configure it 342to include files that 343.Nm 344will generate. 345You should consult 346.Xr resolvconf.conf 5 347for instructions on how to configure your resolver. 348