how can I setup https-dns-proxy to recognise local names? There is a working file “/etc/config/hosts.localnet”, that does its work without the proxy, so that my local machines can find each other. But when I activate the proxy, that file is not used any more.
I followed these instructions(*), and the result is working, but with the above discribed exception. Actually, I do not know how to change this setup to make it work as you suggested.
(*) In the description it is said, that…
Dnsmasq forwards DNS queries to https-dns-proxy which encrypts DNS traffic.
As far as I understand it, dnsmasq should always check a local resolve file before forwarding any dns query, encrypted or not.
I don't use it myself, but on paper -
https-dns-proxy shouldn't be listening to port 53, dnsmasq should.
dnsmasq should use https-dns-proxy as upstream DNS resolver for all queries.
running netstat -tlup executed via ssh should show you who's listening.
I also set those options described in the chapter “Private DNS server cannot be accessed on Android” and that’s where the problem really starts: I activated “private dns” on my phone for the use on mobile network. But I don’t want to toggle this option every time I enter my wifi zone and re-enable that option every time I exit my wifi again.
While connected to my wifi, my phone needs to be able to connect to other local machines, e.g. “smart home” devices. They will only be reachable, if I deactivate the private dns option on the phone, which is of course pretty inconvenient. There must be a better solution to this.
Well, as you said: “…the clients should then fall back to vanilla unencrypted DNS traffic.”
Meaning: they should, but they don’t! Android does not seem to care what it should do: if “private DNS” (that’s what DoH is called on Android) is activated, the phone can’t reach any public site whatsoever when connected to my wifi with banIP on the router.
This is a very sad and frustrating situation:
I’m running a home server that provides a service, to which the appropriate Android app won’t connect if no valid ssl certificate can be found. The app does not accept self signed certs.
Solution to this: LetsEncrypt. Easy to install and working perfectly, even when the server is not publicly accessible.
But: because my home server is not to be connected from the outside, its public name needs to be resolved to its internal IP on my home network, otherwise the LE cert will be rejected as invalid.
This works, unless I activate “private DNS” on my phone: if it’s activated, my phone can’t connect to my home server on my home network, because it will receive the public ip.
On my PC, the solution is simple: just putting the server’s internal ip into /etc/hosts and my PC can reach the internal server by its public name. Great!
But sadly, Android does not provide an easy way to edit /etc/hosts, rooting the device is required and I really don’t want to do that. Of course, the easiest solution to this tricky solution would be me turning off “private DNS” whenever my phone connects to my wifi and reactivate it later. But this will not work reliable all the time due to human nature and it feels like being back in the 1950s again…
I guess I’ll have to look elsewhere for a solution to this, there’s nothing that OpenWRT can do about this.