AdguardTeam / AdGuardHome

Network-wide ads & trackers blocking DNS server
https://adguard.com/adguard-home.html
GNU General Public License v3.0
24.28k stars 1.77k forks source link

Request to Add Custom Local Domain Support for Private DNS Server #7114

Open DaLiWan666 opened 1 month ago

DaLiWan666 commented 1 month ago

Prerequisites

The problem

In the OpenWRT system, I use AdGuard Home to replace the built-in dnsmasq for DNS resolution (AdGuard Home uses port 53, dnsmasq is changed to port 52, and AdGuard Home's Private Reverse DNS Server is set to dnsmasq's port 52). However, the DHCP service is still handled by the original dnsmasq. I have found that local arpa requests can be correctly forwarded to the local dnsmasq for local reverse lookup.

Additionally, OpenWRT has a device domain name feature, which is based on the device name combined with the local domain name in the Network-DHCP/DNS settings, with "lan" as the default. For example, if the device name is "xiaomi-14", the local domain name would be "xiaomi-14.lan". I noticed that many local devices request this local domain name in AdGuard Home, but AdGuard Home does not forward these requests to the Private Reverse DNS Server set to dnsmasq's port 52. Instead, it forwards them to an online DNS server, resulting in a large number of resolution failures with response times over 5000+ milliseconds. Additionally, Windows systems often request wpad plus the local domain name, such as the default "wpad.lan", to find the local proxy. These requests are also wrongly forwarded to the online DNS, causing high latency and no results.

Proposed solution

Therefore, I suggest updating the Private Reverse DNS Server feature to be a Private DNS Server. Additionally, alongside the default forwarding of arpa requests, please add an input field where users can input the local domain name (such as the default "lan"). This would ensure that domain names with the suffix ".lan" are also forwarded to the private DNS server, not limited to arpa reverse queries, ensuring functional implementation and normal latency.

Alternatives considered and additional information

No response

Cebeerre commented 1 month ago

You can actually setup this in the upstreams directly. I've the same setup than you, but changed the default "lan" in OpenWRT to "home.arpa".

Screenshot 2024-07-09 at 14 31 24
DaLiWan666 commented 1 month ago

实际上,您可以直接在上游进行设置。我的设置和你一样,但将OpenWRT中的默认“lan”更改为“home.arpa”。

Screenshot 2024-07-09 at 14 31 24

I tried your method. I set the local domain to "home.lan" and the local server to "/home.lan/". After configuring AdGuard Home, I was able to successfully ping "xiaomi14.home.lan" and see the resolved result. It correctly returned the IP address with a 1ms delay. Thank you very much for your help.

Cebeerre commented 1 month ago

实际上,您可以直接在上游进行设置。我的设置和你一样,但将OpenWRT中的默认“lan”更改为“home.arpa”。

Screenshot 2024-07-09 at 14 31 24

I tried your method. I set the local domain to "home.lan" and the local server to "/home.lan/". After configuring AdGuard Home, I was able to successfully ping "xiaomi14.home.lan" and see the resolved result. It correctly returned the IP address with a 1ms delay. Thank you very much for your help.

You can actually just use "/lan/", so whatever is in the next level domains will be sent to the upstream anyway. Great it works for you ... anyway keep in mind that the current RFC recommends using home.arpa instead of lan, there's actually an ongoing discussion on the OpenWRT forums around changing their default ...