1*9af6c78cSPedro F. Giffuni# openresolv 2*9af6c78cSPedro F. Giffuni 3*9af6c78cSPedro F. Giffuniopenresolv is a [resolvconf](https://en.wikipedia.org/wiki/Resolvconf) 4*9af6c78cSPedro F. Giffuniimplementation which manages `/etc/resolv.conf`. 5*9af6c78cSPedro F. Giffuni 6*9af6c78cSPedro F. Giffuni`/etc/resolv.conf` is a file that holds the configuration for the local 7*9af6c78cSPedro F. Giffuniresolution of domain names. 8*9af6c78cSPedro F. GiffuniNormally this file is either static or maintained by a local daemon, 9*9af6c78cSPedro F. Giffuninormally a DHCP daemon. But what happens if more than one thing wants to 10*9af6c78cSPedro F. Giffunicontrol the file? 11*9af6c78cSPedro F. GiffuniSay you have wired and wireless interfaces to different subnets and run a VPN 12*9af6c78cSPedro F. Giffunior two on top of that, how do you say which one controls the file? 13*9af6c78cSPedro F. GiffuniIt's also not as easy as just adding and removing the nameservers each client 14*9af6c78cSPedro F. Giffuniknows about as different clients could add the same nameservers. 15*9af6c78cSPedro F. Giffuni 16*9af6c78cSPedro F. GiffuniEnter resolvconf, the middleman between the network configuration services and 17*9af6c78cSPedro F. Giffuni`/etc/resolv.conf`. 18*9af6c78cSPedro F. Giffuniresolvconf itself is just a script that stores, removes and lists a full 19*9af6c78cSPedro F. Giffuni`resolv.conf` generated for the interface. It then calls all the helper scripts 20*9af6c78cSPedro F. Giffuniit knows about so it can configure the real `/etc/resolv.conf` and optionally 21*9af6c78cSPedro F. Giffuniany local nameservers other than libc. 22*9af6c78cSPedro F. Giffuni 23*9af6c78cSPedro F. Giffuni## Reasons for using openresolv 24*9af6c78cSPedro F. Giffuni 25*9af6c78cSPedro F. GiffuniWhy openresolv over the 26*9af6c78cSPedro F. Giffuni[Debian implementation](http://qref.sourceforge.net/Debian/reference/ch-gateway.en.html#s-dns-resolvconf)? 27*9af6c78cSPedro F. GiffuniHere's some reasons: 28*9af6c78cSPedro F. Giffuni * Works with 29*9af6c78cSPedro F. Giffuni [POSIX shell and userland](http://www.opengroup.org/onlinepubs/009695399) 30*9af6c78cSPedro F. Giffuni * Does not need awk, grep or sed which means we can work without `/usr` 31*9af6c78cSPedro F. Giffuni mounted 32*9af6c78cSPedro F. Giffuni * Works with other init systems than Debians' out of the box 33*9af6c78cSPedro F. Giffuni * Available as a 2 clause 34*9af6c78cSPedro F. Giffuni [BSD license](http://www.freebsd.org/copyright/freebsd-license.html) 35*9af6c78cSPedro F. Giffuni * Prefer configs via IF_METRIC for dynamic ordering 36*9af6c78cSPedro F. Giffuni * Configures zones for local resolvers other than libc 37*9af6c78cSPedro F. Giffuni 38*9af6c78cSPedro F. GiffuniThe last point is quite important, especially when running VPN systems. 39*9af6c78cSPedro F. GiffuniTake the following resolv.conf files which have been generated by a 40*9af6c78cSPedro F. Giffuni[DHCP client](../dhcpcd) and sent to resolvconf: 41*9af6c78cSPedro F. Giffuni 42*9af6c78cSPedro F. Giffuni``` 43*9af6c78cSPedro F. Giffuni# resolv.conf from bge0 44*9af6c78cSPedro F. Giffunisearch foo.com 45*9af6c78cSPedro F. Giffuninameserver 1.2.3.4 46*9af6c78cSPedro F. Giffuni 47*9af6c78cSPedro F. Giffuni# resolv.conf from tap0 48*9af6c78cSPedro F. Giffunidomain bar.org 49*9af6c78cSPedro F. Giffuninameserver 5.6.7.8 50*9af6c78cSPedro F. Giffuni``` 51*9af6c78cSPedro F. Giffuni 52*9af6c78cSPedro F. GiffuniIn this instance, queries for foo.com will go to 1.2.3.4 and queries for 53*9af6c78cSPedro F. Giffunibar.org will go to 5.6.7.8. 54*9af6c78cSPedro F. GiffuniThis does require the resolvers to be configured to pickup the resolvconf 55*9af6c78cSPedro F. Giffunigenerated configuration for them though. 56*9af6c78cSPedro F. Giffuniopenresolv ships with helpers for: 57*9af6c78cSPedro F. Giffuni * [unbound](http://www.unbound.net/) 58*9af6c78cSPedro F. Giffuni * [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) 59*9af6c78cSPedro F. Giffuni * [ISC BIND](http://www.isc.org/software/bind) 60*9af6c78cSPedro F. Giffuni * [PowerDNS Recursor](http://wiki.powerdns.com/trac) 61*9af6c78cSPedro F. Giffuni 62*9af6c78cSPedro F. GiffuniSee the 63*9af6c78cSPedro F. Giffuni[configuration section](https://roy.marples.name/projects/openresolv/config) 64*9af6c78cSPedro F. Giffunifor more details. 65