qdm12 / dns

Docker DNS server on steroids to access DNS-over-TLS from Cloudflare, Google, Quad9, Quadrant or CleanBrowsing
https://hub.docker.com/r/qmcgaw/cloudflare-dns-server
MIT License
219 stars 37 forks source link

Add support for custom domain forwarders #109

Closed jvandenbroek closed 5 months ago

jvandenbroek commented 2 years ago

Currently I use dnsmasq in front of this docker, so i can resolve some custom domains with other DNS resolvers (eg. local domain to router). Would be nice if this resolver could support it, so I can drop dnsmasq in-between.

Arderos commented 1 year ago

+1 to that. Conditional Forwarders would be a very welcome addition.

MichaelWasher commented 1 year ago

+1 Alternatively, if there is a mechanisms for including custom configuration into the root of the unbound.conf config . Something like this: https://github.com/qdm12/dns/compare/master...MichaelWasher:dns:master

CloudMass commented 11 months ago

I would love to see this change as well. I'm using gluetun in a kubernetes cluster and would like for it to be able to look up DNS addresses in the cluster-dns. I have tested @MichaelWasher changes and confirmed that they are working.

qdm12 commented 9 months ago

I just finished in commit 95ae9e8dcfeb4f432546bc3612069f4cec93cd9d with image qmcgaw/dns:v2.0.0-beta (beta still, almost done!), you can now use MIDDLEWARE_LOCALDNS_RESOLVERS=192.168.1.1:53 for example, and that will forward any requests for local domain names (like abc, abc.local, abc.nonexistingtld) to that address. For now it only works over plaintext DNS, but I don't see a need for tls etc. for the time being. You can also set multiple resolvers with commas in case you need this, and they'll be tried one by one. This will be plugged in Gluetun real soon, and should FINALLYYYY fix the issue where Gluetun cannot resolve local Docker/K8s hostnames!! Let me know if that fits your needs, or if you would need something else 😉 Thanks for your patience! 👍

qdm12 commented 9 months ago

Now it's even better, the local DNS middleware is enabled by default, and will auto-detect your system DNS servers, and try those for any local names it finds. So really zero configuration needed.

For now the limitation is it won't resolve a public TLD host like github.com to a local IP address, but if you would (please actually) need this, let me know and I can implement it within that same middleware 😉

qdm12 commented 5 months ago

156a6957ad2bfe579469f0fc85ae0931828c5c81 adds MIDDLEWARE_SUBSTITUTER_SUBSTITUTIONS where you can define a JSON array of substitutions. For example [{"name":"github.com","ips":["1.2.3.4"]}]. This should thus be fixed (again, this is on the v2.0.0-beta image).