RESOLVCONF(8)

โœจ RESOLVCONF(8) โœจ

okay so bestie, this is resolvconf โ€” it lives in the System Manager's Manual section of your life, and it's genuinely one of those tools that fixes a problem you didn't even know you had. Buckle up ๐ŸŽ€

๐Ÿ’– NAME ๐Ÿ’–

resolvconf โ€” a framework for managing multiple DNS configurations. yes, multiple. it's giving "adulting for your /etc/resolv.conf" ๐Ÿ’…

๐ŸŒธ SYNOPSIS ๐ŸŒธ

resolvconf -I
resolvconf [-m metric] [-p] [-x] -a key <file
resolvconf -C pattern
resolvconf -c pattern
resolvconf [-f] -d key
resolvconf [-x] -iLlp pattern
resolvconf -u
resolvconf --version

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so resolvconf manages resolv.conf(5) files from multiple sources โ€” think DHCP and VPN clients, the whole squad. back in the day, traditionally, the host runs just one client and that one client updates /etc/resolv.conf. cute! simple! but more modern systems frequently have wired and wireless interfaces, and there is no guarantee both are on the same network. and with the advent of VPN and other types of networking daemons, many things now contend for the contents of /etc/resolv.conf. it's a whole fight in the group chat ๐Ÿ˜ญ

resolvconf solves this by letting the daemon send their resolv.conf(5) file to resolvconf via stdin(4) with the argument -a key instead of the filesystem. then resolvconf updates /etc/resolv.conf as it thinks best. no cap, it just handles it.

โš ๏ธ heads up: if /etc/resolv.conf already exists and the top line does not match the expected signature, then resolvconf will refuse to update it unless the -u update command is given. it's not being difficult, it's being safe ๐Ÿซถ

when a local resolver other than libc is installed, such as dnsmasq(8) or named(8), then resolvconf will supply files that the resolver should be configured to include.

at it's heart, resolvconf is a key/value store for resolv.conf files. each entry must have a unique key and should be expressed as interface.protocol so that it's easy to tell from where the resolv.conf file came from. this also allows using pattern matching such as interface.* to match all protocols running on the interface. like, a modern system will likely run DHCP, RA and DHCPv6 which could be from separate programs or one program running many protocols โ€” the way that works is just chef's kiss. however, this is not a fixed requirement, resolvconf will work with any key name and it should be treated as an opaque value outside of resolvconf. iykyk.

resolvconf can mark a resolv.conf as private and optionally non-searchable. this means that the name servers listed in that resolv.conf are only used for queries against the domain/search listed in the same file โ€” and if non-searchable then the domain/search listed are excluded from the global search list defined in /etc/resolv.conf. this only works when a local resolver other than libc is installed. see resolvconf.conf(5) for how to configure resolvconf to use a local name server and how to remove the private marking.

resolvconf can also mark a resolv.conf as exclusive. only the latest exclusive key is used for processing, otherwise all are. main character energy, honestly ๐Ÿ‘‘

when a configuration source goes away โ€” like an interface going down or a VPN stopping โ€” it should then call resolvconf with -d key arguments to clean up the resolv.conf it added previously. for systems that support the concept of persisting configuration when the source is suspended, such as the carrier going down, then it should instead call resolvconf with -C key arguments to deprecate the entry, and -c key to activate the entry when it comes back again. this only affects the order in which the resolv.conf entries are processed. it's a pause, not a breakup ๐Ÿ’”โžก๏ธ๐Ÿ’–

here are some options for the above commands:

  • -f โ€” ignore non existent resolv.conf entries. only really useful for deleting.
  • -m metric โ€” set the metric of the resolv.conf entry when adding it, default of 0. lower metrics take precedence. this affects the default order of entires when listed.
  • -p [pattern] โ€” marks the resolv.conf as private if the -a command is given, otherwise resolv.conf entries having their key matching pattern are listed. if an extra -p is given then the resolv.conf is marked as non-searchable as well. double -p, double the boundaries ๐Ÿšง
  • -x โ€” mark the resolv.conf as exclusive when adding, otherwise only use the latest exclusive key.

resolvconf has some more commands for general usage:

  • -i [pattern] โ€” list the keys stored, optionally matching pattern, we have resolv.conf files for. if the -L option is given first, then the keys will be list post-processed.
  • -L [pattern] โ€” list the resolv.conf files we have, post-processed by the resolvconf.conf(5) configuration. if pattern is specified then we list the files for the keys which match it.
  • -l [pattern] โ€” list the resolv.conf files we have. if pattern is specified then we list the files for the keys which match it.
  • -u โ€” force resolvconf to update all its subscribers. resolvconf does not update the subscribers when adding a resolv.conf that matches what it already has for that key. like, why would it, nothing changed bestie ๐Ÿ™ˆ
  • --version โ€” echo the resolvconf version to stdout.

resolvconf also has some commands designed to be used by its subscribers and system startup:

  • -I โ€” initialise the state directory /run/resolvconf. this should be called after the base state directory has either been cleaned out or mounted as a memory backed filesystem during the initial boot sequence before any daemon has the chance to call resolvconf. first one in gets the aux ๐ŸŽง
  • -R โ€” echo the command used to restart a service.
  • -r service โ€” if the service is running then restart it. if the service does not exist or is not running then zero is returned, otherwise the result of restarting the service.
  • -v โ€” echo variables DOMAINS, SEARCH and NAMESERVERS so that the subscriber can configure the resolver easily.
  • -V โ€” same as -v except that only the information configured in resolvconf.conf(5) is set.

๐ŸŒˆ RESOLV.CONF ORDERING ๐ŸŒˆ

for resolvconf to work effectively, it has to process the resolv.conf entries in the correct order. and the order is, in this exact sequence:

  1. resolvconf first processes keys from the key_order list.
  2. then entries without a metric and that match the dynamic_order list.
  3. then entries with a metric in order.
  4. and finally the rest in the operating systems lexical order.

see resolvconf.conf(5) for details on these lists. it's a whole lineup and everyone has their spot โœจ

๐Ÿงš PROTOCOLS ๐Ÿงš

here are some suggested protocol tags to use for each resolv.conf:

  • dhcp โ€” Dynamic Host Configuration Protocol.
  • ppp โ€” Point-to-Point Protocol.
  • ra โ€” IPv6 Router Advertisement.
  • dhcp6 โ€” Dynamic Host Configuration Protocol, version 6.

๐Ÿ’œ IMPLEMENTATION NOTES ๐Ÿ’œ

if a subscriber has the executable bit then it is executed โ€” otherwise it is assumed to be a shell script and sourced into the current environment in a subshell. this is done so that subscribers can remain fast, but are also not limited to the shell language. slay for flexibility ๐Ÿ’…

portable subscribers should not use anything outside of /bin and /sbin because /usr and others may not be available when booting. also, it would be unwise to assume any shell specific features. ngl, keep it bare bones, that's the vibe check ๐Ÿฉต

๐Ÿ“ ENVIRONMENT ๐Ÿ“

  • IF_METRIC โ€” if the -m option is not present then we use IF_METRIC for the metric.
  • IF_PRIVATE โ€” marks the resolv.conf as private.
  • IF_NOSEARCH โ€” marks the resolv.conf as non-searchable.
  • IF_EXCLUSIVE โ€” marks the resolv.conf as exclusive.

๐ŸŽ€ FILES ๐ŸŽ€

  • /etc/resolv.conf.bak โ€” backup file of the original resolv.conf.
  • /etc/resolvconf.conf โ€” configuration file for resolvconf.
  • /usr/lib/resolvconf โ€” directory of subscribers which are run every time resolvconf adds, deletes or updates.
  • /usr/lib/resolvconf/libc.d โ€” directory of subscribers which are run after the libc subscriber is run.
  • /run/resolvconf โ€” state directory for resolvconf.

โญ NOTES โญ

domain labels are assumed to be in ASCII and are converted to lower case to avoid duplicate zones when given differing case from different sources. lowercase everything, it's the law ๐Ÿ”ค

when running a local resolver other than libc, you will need to configure it to include files that resolvconf will generate. you should consult resolvconf.conf(5) for instructions on how to configure your resolver. go read it, bestie, it's important ๐Ÿ“–

๐ŸŒธ SEE ALSO ๐ŸŒธ

resolver(3), stdin(4), resolv.conf(5), resolvconf.conf(5)

๐Ÿ‘‘ HISTORY ๐Ÿ‘‘

this implementation of resolvconf is called openresolv and is fully command line compatible with Debian's resolvconf, as written by Thomas Hood. heritage! lineage! iconic ๐Ÿ’€

๐Ÿซถ AUTHORS ๐Ÿซถ

Roy Marples <roy@marples.name>

๐Ÿ’€ BUGS ๐Ÿ’€

please report them to http://roy.marples.name/projects/openresolv โ€” they genuinely want to hear it, no gatekeeping ๐Ÿ”ฅ


and that's the whole page, bestie โ€” this one came from Debian, dated June 26, 2025, filed under RESOLVCONF(8) in the System Manager's Manual โœจ go forth and resolve some names ๐Ÿ’–

๐Ÿ“ฆ where this page comes from