Automatic configuration of /etc/resolv.conf

  1. Stop configuring /etc/resolv.conf with local loop addresses by default since it is confusing and it is unclear what happens when there are multiple dnsmasq instances active and when different port(s) are used;
  2. Abandon 'localuse' option for dnsmasq instances (/etc/config/dhcp);
  3. Introduce a new system-wide option (/etc/config/system) called 'localdns' (or something alike). This option defines how OpenWrt automatically configures /etc/resolv.conf. Following - mutually exclusive - choices should be available for 'localdns':
  • 'upstream': OpenWrt uses WAN name servers to automatically configure /etc/resolv.conf (default value)
  • 'local interface name e.g. lan3 or guest': OpenWrt uses the name servers for the given interface to automatically configure /etc/resolv.conf. If no name servers defined for the local interface fall back to 'upstream'
  • 'localhost[:port]': OpenWrt automatically configures /etc/resolv.conf with local loop address (dependent if there are dnsmasq instances active that listen to the lo-interface);
  • '/etc/localdns.resolv.conf' (user modifiable, by default contains upstream servers), OpenWrt symlinks /etc/resolv.conf to /etc/localdns.resolv.conf

I've tripped up on this a number of times, especially when testing new VMs.

Perhaps you can make a PR for this behaviour?

I made a bug report on Github