AdguardTeam / AdGuardHome

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

Custom reverse lookup fails on OpenWRT #7364

Open sgofferj opened 1 month ago

sgofferj commented 1 month ago

Prerequisites

Platform (OS and CPU architecture)

Linux, ARM64

Installation

Custom package (OpenWrt, HomeAssistant, etc; please mention in the description)

Setup

On one machine

AdGuard Home version

v0.107.53

Action

I have AGH set up on OpenWRT. Because I have different subnets with different domain names, I have multiple instances of dnsmasq running: Port 5352 for 192.168.2.0/24 Port 5353 for 192.168.3.0/24

I can successfully resolve IP via those instances e.g. with nslookup 192.168.3.6 127.0.0.1:5353

In AGH I have the following entries in my upstream servers list:

[/iot.gofferje.net/]127.0.0.1:5352
[/2.168.192.in-addr.arpa/]127.0.0.1:5352
[/voice.gofferje.net/]127.0.0.1:5353
[/3.168.192.in-addr.arpa/]127.0.0.1:5353
https://dns10.quad9.net/dns-query
https://dns.cloudflare.com/dns-query

Additionally, I have the following configuration in the private reverse DNS servers list:

127.0.0.1:5352
127.0.0.1:5353

"Use private reverse DNS servers" is checked.

I can successfully resolve .iot.gofferje.net and .voice.gofferje.net via AGH but the reverse lookups fail with NXDOMAIN. As mentioned above, I can do the reverse lookup successfully when telling nslookup to contact the respective dnsmasq instance directly, so it appears to be a problem with AGH.

Expected result

Reverse lookup

Actual result

NXDOMAIN

Additional information and/or screenshots

OpenWrt SNAPSHOT (r27777-4d81f40d63)

sgofferj commented 1 month ago

Possibly related to #4290, however in my case no IPv6 is involved.

sgofferj commented 1 month ago

tcpdump seems to confirm that AGH is not querying the configured upstream servers. Here is a tcpdump of me doing nslookup 192.168.3.6 127.0.0.1:5353

22:10:38.659540 IP localhost.34339 > localhost.5353: 39891+ PTR (QM)? 6.3.168.192.in-addr.arpa. (42)
22:10:38.659681 IP localhost.5353 > localhost.34339: 39891* 1/0/0 PTR SEPxxxxxxxxxxxx.voice.gofferje.net. (90)

And here a tcpdump of me querying AGH with nslookup 192.168.3.6 127.0.0.1:53:

22:13:39.683965 IP localhost.39241 > localhost.53: 13139+ PTR? 6.3.168.192.in-addr.arpa. (42)
22:13:39.685186 IP localhost.53 > localhost.39241: 13139 NXDomain* 0/1/0 (97)

AGH does not seem to query the upstream server 127.0.0.1:5353.

GoetzGoerisch commented 4 weeks ago

Try adding *. infront of your domains. Although this should only appaer in 0.108.x it is already active in 0.170.53 for me.

sgofferj commented 4 weeks ago

Finally had some time to debug. Turns out, the problem seems to be in the documentation. The documentation for reverse lookups says

  1. Enter the following into the “Upstream DNS servers” field on the “Settings → DNS settings” page [/in-addr.arpa/]192.168.8.8 [/ip6.arpa/]192.168.8.8

and

  1. Enter the following into the “Private reverse DNS servers” field on the same page below the previous field 192.168.8.8

That is not correct. The patterns also need to go into “Private reverse DNS servers”. Then it works as expected.