Pulling my hair out on this one. I've been searching for hours but cannot find an answer to what should be a simple thing.
I have unbound installed on one of my routers but only want to use it as a dns server.
The unbound service is putting 127.0.0.1 in the resolve files but I don't want to use unbound for the router dns, I want to use the upstream dhcp dns servers being given.
In other words, I also don't want to use unbound as a dns forwarder but as a simple recursive dns server on the router for emergencies. Outside of that function, I just want the local services to use the dhcp servers being given by the upstream dhcp server.
I don't want to live on the edge :).
I know there is an option, it's a simple directive, maybe two that I used to apply a long time ago but cannot find my notes. I think it was applied in the /etc/config/dhcp file.
The directives said to use the upstream dhcp server dns being provided and not local.
I don't have dnsmasq installed so I have no such option.
The device is not actually being used as a router, just a little sdr antenna and I wanted to have a dns server on it as well for some redundancy.
Before doing that, which is a hack, I know there is a simple directive or two that can be used.
I usually use image builder to keep a copy of my original firmware and tend to make the changes in the files/ directory otherwise I lose track of hacks which is why I don't tend to use hacks.
you could try echo "nameserver 8.8.8.8" > /etc/resolv.conf (or whatever DNS IP you'd like to use) to your local start up script.
you can run the command from cli, to see if it works, 1st.
I don't use any gui, command line only.
Yes, disabling unbound uses the dhcp provided dns servers.
I thought it might be this option, enabled or not but that didn't work.
config zone 'fwd_isp'
# forward ISP account management to DHCP announced DNS servers
option enabled '0'
option fallback '1'
option resolv_conf '1'
option zone_type 'forward_zone'
list zone_name 'isp-bill.example.com.'
list zone_name 'isp-mail.example.net.'
I'm almost sure it was a directive in the dhcp file.
If dnsmasq isn’t active, it’s not going to process the dhcp config file for this particular purpose. Unbound overwrites the resolv.conf because that function I mentioned earlier tells it to.
There's no specific UCI option, and you have only 2 ways to skip overwriting the resolver config, i.e. change the default Unbound port, or enable and start Dnsmasq as the default resolver:
Just breaking in on this conversation with my 2c:
I've been using unbound for a while now, and what I've noticed is that for DNS requests it is simply a cached DNS resolver. It uses upstream servers to forward any request not in the cache. If you remove the default zones and replace it with a zone with the servers of your choice, you should be set.
To protect against upstream 127.0.0.0/8 responses you can turn on the "Filter localhost rebind" and and there are also options for filtering private rebinds. I'm sorry I am mainly a LUCI user, so I can't tell you the CLI commands...hope this helps tho
I wonder if maybe I used to have dnsmasq installed after all? I definitely recall all I needed was one or two directives in a config file. I'll give that a try right now.