DHCP client peerdns resolv.conf


Is it possible to use the built in peerdns option for DHCP client interfaces but customise the resolv.conf that is written to? It always seems to use /etc/resolv.conf. I have a dnsmasq instance using a specific resolv.conf file, which is obviously configurable with uci. But I can’t see how I can populate this file with uci configuration for a DHCP client interface. I have resorted to using a hotplug iface script to do this. I just wanted to check it wasn’t possible a nicer way.


Each learnt nameserver from interface ifname goes to /tmp/resolv.conf.<ifname>

This is by default symlink to /tmp/resolv.conf , which is pointing to localhost, that is dnsmasq. Also there is /tmp/resolv.conf.auto , which is a combination of all available nameservers.

If you mean to advertise it with dhcp, then you can with option 6.

1 Like

So I have two DHCP client interfaces (no DHCP servers here). One DHCP client I want to use the provided DNS servers (peerdns) for local resolution. The other DHCP client I want to use the provided DNS servers for dnsmasq's usage. I have disabled dnsmasq for local use.

I see /etc/resolv.conf -> /tmp/resolv.conf -> /tmp/resolv.conf.d/resolv.conf.auto. I don't have separate resolv.conf files for each interface as you describe. So the resolv.conf file used for local resolution has the combined nameservers from both DHCP clients - this isn't what I want.

Does that make sense?

Yes, should be doable.
Please run the following commands (copy-paste the whole block) and paste the output here, using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have

ubus call system board; \
uci export network; uci export dhcp; \
ls -l  /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/* ; head -n -0 /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/*
1 Like