AdguardTeam / AdGuardHome

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

Reverse lookup fails while querying IPv4 addresses when using Adguard Home server's IPv6 address #4290

Open isg17 opened 2 years ago

isg17 commented 2 years ago

Issue Details

Expected Behavior

When performing reverse lookups on IPv4 addresses on a dual-stacked (IPv4 and IPv6) Adguard Home DNS server, the lookup fails while using Adguard Home DNS server's IPv6 address. Additional testing performed indicates:

Actual Behavior

The PTR record for the IPv4 address query is not found. For example: Adguard_Home_Reverse_Lookup_Bug_v0.107.3.txt Adguard_Home_Reverse_Lookup_Bug_v0.108.0-b.3.txt Host 26.1.168.192.in-addr.arpa. not found: 3(NXDOMAIN)



;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56159 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;MyLaptop-WiFi.local. IN A

;; ANSWER SECTION: MyLaptop-WiFi.local. 10 IN A 192.168.1.26

Received 53 bytes from 192.168.1.1#53 in 0 ms Trying "MyLaptop-WiFi.local" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55608 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;MyLaptop-WiFi.local. IN AAAA

;; ANSWER SECTION: MyLaptop-WiFi.local. 10 IN AAAA 2600:6c54:XXXX:XXXX::1a

Received 65 bytes from 192.168.1.1#53 in 0 ms Trying "MyLaptop-WiFi.local" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45305 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;MyLaptop-WiFi.local. IN MX

Received 37 bytes from 192.168.1.1#53 in 0 ms


;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26895 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;MyLaptop-WiFi.local. IN A

;; ANSWER SECTION: MyLaptop-WiFi.local. 10 IN A 192.168.1.26

Received 53 bytes from 2600:6c54:XXXX:XXXX::1#53 in 9 ms Trying "MyLaptop-WiFi.local" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63375 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;MyLaptop-WiFi.local. IN AAAA

;; ANSWER SECTION: MyLaptop-WiFi.local. 10 IN AAAA 2600:6c54:XXXX:XXXX::1a

Received 65 bytes from 2600:6c54:XXXX:XXXX::1#53 in 0 ms Trying "MyLaptop-WiFi.local" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8388 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;MyLaptop-WiFi.local. IN MX

Received 37 bytes from 2600:6c54:XXXX:XXXX::1#53 in 0 ms


;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60938 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;26.1.168.192.in-addr.arpa. IN PTR

;; ANSWER SECTION: 26.1.168.192.in-addr.arpa. 10 IN PTR MyLaptop-WiFi.local.

Received 76 bytes from 192.168.1.1#53 in 0 ms


Host 26.1.168.192.in-addr.arpa. not found: 3(NXDOMAIN) Received 177 bytes from 2600:6c54:XXXX:XXXX::1#53 in 0 ms


;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11848 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;26.1.168.192.in-addr.arpa. IN PTR

;; ANSWER SECTION: 26.1.168.192.in-addr.arpa. 0 IN PTR MyLaptop-WiFi.local.

Received 76 bytes from 2600:6c54:XXXX:XXXX::1#5353 in 0 ms root@WiFi6514A-R:~#

Screenshots

Screenshot:

Additional Information

ainar-g commented 2 years ago

Hello and thank you for the thorough report. I can't seem to reproduce that behaviour, at least on Ubuntu with nslookup. We'll try on an OpenWrt machine a bit later, but until then, does this behaviour reproduce with it?

nslookup -debug '192.168.1.26' '2001:…'

Also, just to be clear, what are the values you're using in the “Private reverse DNS servers” field on the “DNS settings” page? Do you see AdGuard Home forwarding these PTRs to one of these upstreams?

Thanks!

isg17 commented 2 years ago

After your response, I took some time to double-check configuration issues on my end. I even split the DNS servers (OpenWRT+dnsmasq on the router and Adguard Home on RPi3), and the problem persisted.

Note: If I reconfigure dnsmasq to listen on UDP/53 and then forward to Adguard Home on UDP/5353, the reverse querying works. However, that is not the configuration that is optimal for me.

Please see my three test cases and results where I placed the reverse zones in the Upstream DNS servers or the Private reverse DNS servers sections.

Additional_NSLOOKUP_Traces.txt


| Upstream DNS servers | 208.67.222.222 | 208.67.220.220 | [/local/]127.0.0.1:5353 | [/lan/]127.0.0.1:5353 | [/168.192.in-addr.arpa/]127.0.0.1:5353 | [/ip6.arpa/]127.0.0.1:5353

| Private reverse DNS servers | 127.0.0.1:5353



QUESTIONS:
5.1.168.192.in-addr.arpa, type = PTR, class = IN
ANSWERS:
AUTHORITY RECORDS:
->  5.1.168.192.in-addr.arpa
origin = fake-for-negative-caching.adguard.com
mail addr = hostmaster.5.1.168.192.in-addr.arpa
serial = 100500
refresh = 1800
retry = 900
expire = 604800
minimum = 86400
ttl = 10
ADDITIONAL RECORDS:

** server can't find 5.1.168.192.in-addr.arpa: NXDOMAIN


QUESTIONS:
5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa, type = PTR, class = IN
ANSWERS:
->  5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa
name = hp-clj.lan.
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa name = hp-clj.lan.


QUESTIONS:
5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa, type = PTR, class = IN
ANSWERS:
->  5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa
name = hp-clj.lan.
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa name = hp-clj.lan.


QUESTIONS:
hp-clj.lan, type = A, class = IN
ANSWERS:
->  hp-clj.lan
internet address = 192.168.1.5
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

Name: hp-clj.lan Address: 192.168.1.5


QUESTIONS:
5.1.168.192.in-addr.arpa, type = PTR, class = IN
ANSWERS:
->  5.1.168.192.in-addr.arpa
name = hp-clj.lan.
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

5.1.168.192.in-addr.arpa name = hp-clj.lan.


QUESTIONS:
hp-clj.lan, type = A, class = IN
ANSWERS:
->  hp-clj.lan
internet address = 192.168.1.5
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

Name: hp-clj.lan Address: 192.168.1.5



| Upstream DNS servers | 208.67.222.222 | 208.67.220.220 | [/local/]127.0.0.1:5353 | [/lan/]127.0.0.1:5353

| Private reverse DNS servers | 127.0.0.1:5353 | [/168.192.in-addr.arpa/]127.0.0.1:5353 | [/ip6.arpa/]127.0.0.1:5353



QUESTIONS:
5.1.168.192.in-addr.arpa, type = PTR, class = IN
ANSWERS:
AUTHORITY RECORDS:
->  5.1.168.192.in-addr.arpa
origin = fake-for-negative-caching.adguard.com
mail addr = hostmaster.5.1.168.192.in-addr.arpa
serial = 100500
refresh = 1800
retry = 900
expire = 604800
minimum = 86400
ttl = 10
ADDITIONAL RECORDS:

** server can't find 5.1.168.192.in-addr.arpa: NXDOMAIN


QUESTIONS:
5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa, type = PTR, class = IN
ANSWERS:
AUTHORITY RECORDS:
->  0.1.0.6.2.ip6.arpa
origin = dns101.comcast.net
mail addr = dnsmaster.comcastonline.com
serial = 2014093026
refresh = 7200
retry = 300
expire = 604800
minimum = 900
ttl = 823
ADDITIONAL RECORDS:

** server can't find 5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa: NXDOMAIN


QUESTIONS:
5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa, type = PTR, class = IN
ANSWERS:
->  5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa
name = hp-clj.lan.
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa name = hp-clj.lan.


QUESTIONS:
hp-clj.lan, type = A, class = IN
ANSWERS:
->  hp-clj.lan
internet address = 192.168.1.5
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

Name: hp-clj.lan Address: 192.168.1.5


QUESTIONS:
5.1.168.192.in-addr.arpa, type = PTR, class = IN
ANSWERS:
->  5.1.168.192.in-addr.arpa
name = hp-clj.lan.
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

5.1.168.192.in-addr.arpa name = hp-clj.lan.


QUESTIONS:
hp-clj.lan, type = A, class = IN
ANSWERS:
->  hp-clj.lan
internet address = 192.168.1.5
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

Name: hp-clj.lan Address: 192.168.1.5



| Upstream DNS servers | 208.67.222.222 | 208.67.220.220 | [/local/]127.0.0.1:5353 | [/lan/]127.0.0.1:5353

| Private reverse DNS servers | [/168.192.in-addr.arpa/]127.0.0.1:5353 | [/ip6.arpa/]127.0.0.1:5353



QUESTIONS:
5.1.168.192.in-addr.arpa, type = PTR, class = IN
ANSWERS:
AUTHORITY RECORDS:
->  5.1.168.192.in-addr.arpa
origin = fake-for-negative-caching.adguard.com
mail addr = hostmaster.5.1.168.192.in-addr.arpa
serial = 100500
refresh = 1800
retry = 900
expire = 604800
minimum = 86400
ttl = 10
ADDITIONAL RECORDS:

** server can't find 5.1.168.192.in-addr.arpa: NXDOMAIN


QUESTIONS:
5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa, type = PTR, class = IN
ANSWERS:
AUTHORITY RECORDS:
->  0.1.0.6.2.ip6.arpa
origin = dns101.comcast.net
mail addr = dnsmaster.comcastonline.com
serial = 2014093026
refresh = 7200
retry = 300
expire = 604800
minimum = 900
ttl = 900
ADDITIONAL RECORDS:

** server can't find 5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa: NXDOMAIN


QUESTIONS:
5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa, type = PTR, class = IN
ANSWERS:
->  5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa
name = hp-clj.lan.
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.X.X.X.X.X.X.X.3.0.6.0.1.0.6.2.ip6.arpa name = hp-clj.lan.


QUESTIONS:
hp-clj.lan, type = A, class = IN
ANSWERS:
->  hp-clj.lan
internet address = 192.168.1.5
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

Name: hp-clj.lan Address: 192.168.1.5


QUESTIONS:
5.1.168.192.in-addr.arpa, type = PTR, class = IN
ANSWERS:
->  5.1.168.192.in-addr.arpa
name = hp-clj.lan.
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

5.1.168.192.in-addr.arpa name = hp-clj.lan.


QUESTIONS:
hp-clj.lan, type = A, class = IN
ANSWERS:
->  hp-clj.lan
internet address = 192.168.1.5
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

Name: hp-clj.lan Address: 192.168.1.5

Birbber commented 2 years ago

@isg17 Hi. Sorry for the long silence! Is this issue still relevant?

isg17 commented 2 years ago

This is still relevant and the issue is still present on v0.107.11.