RESOLV.CONF on OpenWRT

Introduction

The resolv.conf file is a plain text file that contains DNS Server IP Address used for Name Resolution: resolv.conf - Wikipedia Unlike most Linux based systems where the resolv.conf file is manually configured, in OpenWRT it is dynamically generated.

With the default install of OpenWRT, the resolv.conf file is automatically generated during boot up and place here: /tmp (Full Path: /tmp/resolv.conf.auto

And now you might be saying, "...wait a minute, resolv.conf and resolv.conf.auto, is there a typo there? Nope. Here's what happens when OpenWRT boots up;

  • /tmp/resolv.conf.auto is created during bootup from the DNS Servers configured for each interface (IE, if the WAN interface has a single DNS Server defined, the /tmp/resolv.conf.auto file will have one entry, if there are two DNS Servers defined for the WAN interface the same /tmp/resolv.conf.auto file will have two entries, if there are two WAN interfaces all of their DNS Servers will be included in the /tmp/resolve.conf.auto file, etc.)
  • A Symbolic Link is created as follows: /tmp/resolv.conf → /tmp/resolv.conf.auto (Command Equivalent: ln -s /tmp/resolv.conf.auto /tmp/resolv.conf)
  • Another Symbolic Link is created as follows: /etc/resolv.conf → /tmp/resolv.conf (Command Equivalent: ln -s /tmp/resolv.conf /etc/resolv.conf)

So the result is /etc/resolv.conf is a Symbolic Link that eventually points to /tmp/resolv.conf.auto through another Symbolic Link /tmp/resolv.conf

Various software such as DNSMASQ manipulates the settings in the resolv.conf file