TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
4.27k stars 418 forks source link

[Feature request] Use DHCP provided DNS server as forwarder #617

Closed boenrobot closed 6 months ago

boenrobot commented 1 year ago

I use Technitium DNS Server on my local machine primary as a way to have a more flexible and powerful version of a "hosts" file, and occasionally as a "test DNS server" in virtual machines. That is, it is a recursive DNS that is not accessed by outside devices.

For any hostname not defined by the DNS server itself, I need to forward the DNS request. While there is a way to define a forwarder statically, there does not seem to be a way to automatically take one based on what the device's ISP may provide through DHCP. There should be an option to include those, and perhaps even an option on whether to use them before or after statically defined one. In my case, I want to use them before statically defined ones, as they're noticeably faster that CloudFlare or Google, and I don't care that much about the privacy implication.

ShreyasZare commented 1 year ago

Thanks for the request. I will check if such an option can be added to work cross platform.

However, the second part of the request where you wish to be able to prioritize forwarders is not a good idea. Such implementation will add too much delays in resolving the domain name when your prioritized forwarder does not respond in time. Which is specifically why the DNS server randomly chooses multiple forwarders and queries concurrently and uses the fastest response that is available.

ShreyasZare commented 1 year ago

It seems that adding such feature that will work cross platform is not feasible. This is since, when you set your local config to use 127.0.0.1 as the static DNS server, the .NET runtime will return the same address when trying to probe the DNS servers on the network adapter. Thus the DNS servers received via the DHCP server wont be available to be used.

ShreyasZare commented 1 year ago

Probably this may be feasible. Will explore some options and update here.

ShreyasZare commented 6 months ago

This feature is not feasible. It requires writing a DHCP client to discover local DHCP server and thus getting out of scope for the project.