AdguardTeam / AdGuardHome

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

2 PTR records are being shown for AGH #7117

Closed iptvcld closed 3 months ago

iptvcld commented 3 months ago

Prerequisites

Platform (OS and CPU architecture)

Linux, ARM64

Installation

GitHub releases or script from README

Setup

On one machine

AdGuard Home version

0.107.51

Action

nslookup 10.200.1.50 50.1.200.10.in-addr.arpa name = AdGuardDNS1.example.com. 50.1.200.10.in-addr.arpa name = AdGuardDNS1.

Authoritative answers can be found from:

My 2nd instance is fine

nslookup 10.200.1.51 51.1.200.10.in-addr.arpa name = AdGuardDNS2.example.com.

Expected result

nslookup 10.200.1.50 50.1.200.10.in-addr.arpa name = AdGuardDNS1.example.com.

Actual result

I seem to have 2 PTR records for my AGH 1st instance. But if I run the same lookup on my 2nd agh it’s fine and only shows 1 PTR

Additional information and/or screenshots

No response

iptvcld commented 3 months ago

This is my host file

127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters --BEGIN PVE --- 10.200.1.50 AdGuardDNS1.example.com AdGuardDNS1 --- END PVE ---

My 2nd instance 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters --- BEGIN PVE --- 10.200.1.51 AdGuardDNS2.example.com AdGuardDNS2 --- END PVE ---

iptvcld commented 3 months ago

Any suggestions?

tjharman commented 3 months ago

Do you have the same host configured for reverse lookups on both AdguardHome hosts?

image
iptvcld commented 3 months ago

@tjharman yes, I have the same IP on both dns servers. That IP is for my pfsense interface and since I am using sync for my dns servers, they both are the same

I also have this in my upstream [/*.example.com/]10.200.1.1

IMG_4440

tjharman commented 3 months ago

I see you're running Proxmox.

Is the output of cat /etc/resolv.conf the same on both instances?

Also: How are you syncing the two AdGuardHome instances?

iptvcld commented 3 months ago

@tjharman Yes, both my DNS AGH servers are on a proxmox node - I have 2 proxmox servers running.

cat /etc/resolv.conf (DNS1) --- BEGIN PVE --- search example.com nameserver 10.200.1.50 nameserver 10.200.1.51 --- END PVE ---

cat /etc/resolv.conf (DNS2) --- BEGIN PVE --- search example.com nameserver 10.200.1.50 nameserver 10.200.1.51 --- END PVE ---

As for Sync, i am using an Unraid docker with "lscr.io/linuxserver/adguardhome-sync:latest" as the repo

tjharman commented 3 months ago

One last thing before I raise this up to the devs - can you setup a unix/linux host with the "dig" tool installed and verify you get the same results with

dig @10.200.1.50 -x 10.200.1.50
dig @10.200.1.50 -x 10.200.1.51
dig @10.200.1.51 -x 10.200.1.50
dig @10.200.1.51 -x 10.200.1.51
iptvcld commented 3 months ago

No problem - I just ran these on a different linux host, below are the results

root@Mon:~# dig @10.200.1.50 -x 10.200.1.50

; <<>> DiG 9.18.24-1-Debian <<>> @10.200.1.50 -x 10.200.1.50
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31058
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

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

;; ANSWER SECTION:
50.1.200.10.in-addr.arpa. 10    IN      PTR     AdGuardDNS1.example.com.
50.1.200.10.in-addr.arpa. 10    IN      PTR     AdGuardDNS1.

;; Query time: 1 msec
;; SERVER: 10.200.1.50#53(10.200.1.50) (UDP)
;; WHEN: Mon Jul 08 16:02:54 EDT 2024
;; MSG SIZE  rcvd: 107
root@Mon:~# dig @10.200.1.50 -x 10.200.1.51

; <<>> DiG 9.18.24-1-Debian <<>> @10.200.1.50 -x 10.200.1.51
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3648
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;51.1.200.10.in-addr.arpa.      IN      PTR

;; ANSWER SECTION:
51.1.200.10.in-addr.arpa. 3600  IN      PTR     AdGuardDNS2.example.com.

;; Query time: 1 msec
;; SERVER: 10.200.1.50#53(10.200.1.50) (UDP)
;; WHEN: Mon Jul 08 16:04:06 EDT 2024
;; MSG SIZE  rcvd: 93
root@Mon:~# dig @10.200.1.51 -x 10.200.1.50

; <<>> DiG 9.18.24-1-Debian <<>> @10.200.1.51 -x 10.200.1.50
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36144
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;50.1.200.10.in-addr.arpa.      IN      PTR

;; ANSWER SECTION:
50.1.200.10.in-addr.arpa. 3600  IN      PTR     AdGuardDNS1.example.com.

;; Query time: 0 msec
;; SERVER: 10.200.1.51#53(10.200.1.51) (UDP)
;; WHEN: Mon Jul 08 16:05:07 EDT 2024
;; MSG SIZE  rcvd: 93
root@Mon:~# dig @10.200.1.51 -x 10.200.1.51

; <<>> DiG 9.18.24-1-Debian <<>> @10.200.1.51 -x 10.200.1.51
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39601
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

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

;; ANSWER SECTION:
51.1.200.10.in-addr.arpa. 10    IN      PTR     AdGuardDNS2.example.com.
51.1.200.10.in-addr.arpa. 10    IN      PTR     AdGuardDNS2.

;; Query time: 0 msec
;; SERVER: 10.200.1.51#53(10.200.1.51) (UDP)
;; WHEN: Mon Jul 08 16:05:47 EDT 2024
;; MSG SIZE  rcvd: 107
iptvcld commented 3 months ago

Do you think my host file is causing this?

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
--BEGIN PVE ---
10.200.1.50 AdGuardDNS1.example.com AdGuardDNS1
--- END PVE ---

My 2nd instance
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
--- BEGIN PVE ---
10.200.1.51 AdGuardDNS2.example.com AdGuardDNS2
--- END PVE ---
tjharman commented 3 months ago

Ok great to see you're getting 51.1.200.10.in-addr.arpa. 10 IN PTR AdGuardDNS2. when you query the second host for its IP.

This is just going to be because of your hosts file, yes. If you were to add

10.200.1.50 AdGuardDNS1.example.com AdGuardDNS1 to AdGuardDNS2's host file and 10.200.1.51 AdGuardDNS2.example.com AdGuardDNS2 to AdGuardDNS1's host file I'm sure you'd then find you're getting the same results then.

Please test and confirm.

Thanks!

iptvcld commented 3 months ago
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
# --- BEGIN PVE ---
10.200.1.50 AdGuardDNS1.example.com AdGuardDNS1
10.200.1.51 AdGuardDNS2.example.com AdGuardDNS2
# --- END PVE ---
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
# --- BEGIN PVE ---
10.200.1.51 AdGuardDNS2.example.com AdGuardDNS2
10.200.1.50 AdGuardDNS1.example.com AdGuardDNS1
# --- END PVE ---
nslookup 10.200.1.50
50.1.200.10.in-addr.arpa        name = AdGuardDNS1.example.com.
50.1.200.10.in-addr.arpa        name = AdGuardDNS1.

Authoritative answers can be found from:
nslookup 10.200.1.51
51.1.200.10.in-addr.arpa        name = AdGuardDNS2.example.com.
51.1.200.10.in-addr.arpa        name = AdGuardDNS2.

Authoritative answers can be found from:
tjharman commented 3 months ago

Ok neat - happy to close this as not an Adguard issue?

iptvcld commented 3 months ago

So this is normal behavior? When i perform a nslookup from a WIndows device it shows 1 PTR record but shows 2 PTRs via SH

tjharman commented 3 months ago

I believe so, yes, but I will ask the devs to look at this ticket before I close it.

iptvcld commented 3 months ago

Its just odd that the configs are the same and yet AGH2 shows 1 PTR while AGH1 shows 2 records

iptvcld commented 3 months ago

Also, as a test i just I just added both lines to only my AGH1 DNS server

10.200.1.50 AdGuardDNS1.example.com AdGuardDNS1
10.200.1.51 AdGuardDNS2.example.com AdGuardDNS2

and nslookup has 2 PTR records when i lookup 50 and 51 without having the add the other line to the 2nd dns server

tjharman commented 3 months ago

Right, but the second entry is obviously being added by the hosts file entry - we proved that with the fact you get the same result when you query AdguardHome2 for its hostname:

From your post above:

root@Mon:~# dig @10.200.1.51 -x 10.200.1.51

; <<>> DiG 9.18.24-1-Debian <<>> @10.200.1.51 -x 10.200.1.51
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39601
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

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

;; ANSWER SECTION:
51.1.200.10.in-addr.arpa. 10    IN      PTR     AdGuardDNS2.example.com.
51.1.200.10.in-addr.arpa. 10    IN      PTR     AdGuardDNS2.

;; Query time: 0 msec
;; SERVER: 10.200.1.51#53(10.200.1.51) (UDP)
;; WHEN: Mon Jul 08 16:05:47 EDT 2024
;; MSG SIZE  rcvd: 107

You can fix this if it's annoying by following what's in this thread.

iptvcld commented 3 months ago

Ok, i just changed this config to false and rebooted

hostsfile_enabled: false
nslookup 10.200.1.50
50.1.200.10.in-addr.arpa        name = AdGuardDNS1.example.com.
dig @10.200.1.50 -x 10.200.1.50

; <<>> DiG 9.18.24-1-Debian <<>> @10.200.1.50 -x 10.200.1.50
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62293
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;50.1.200.10.in-addr.arpa.      IN      PTR

;; ANSWER SECTION:
50.1.200.10.in-addr.arpa. 3600  IN      PTR     AdGuardDNS1.example.com.

;; Query time: 1 msec
;; SERVER: 10.200.1.50#53(10.200.1.50) (UDP)
;; WHEN: Mon Jul 08 21:30:36 UTC 2024
;; MSG SIZE  rcvd: 93

Looks like this is fixed the issue for me, thank you! Would you know why this was an issue only for my 1st AGH and was fine for my 2nd server even though they has that config option set to true on both?

tjharman commented 3 months ago

It was an issue for your second AdGuardHome. You proved as much with your output here

You queried your AdGuard2 host for it's ip address and you got the same duplicate result:

;; ANSWER SECTION:
51.1.200.10.in-addr.arpa. 10    IN      PTR     AdGuardDNS2.example.com.
51.1.200.10.in-addr.arpa. 10    IN      PTR     AdGuardDNS2.

The issue only appears when you a query a host for its ip address. So when you queried AdguardHome2 for its ip address you got the same double result.

iptvcld commented 3 months ago

Correct - before i made this change, when i performed a lookup for the IP on AGH1, i was seeing 2 records but only seeing 1 record for the 2nd dns server

nslookup 10.200.1.50
50.1.200.10.in-addr.arpa name = AdGuardDNS1.example.com.
50.1.200.10.in-addr.arpa name = AdGuardDNS1.

Authoritative answers can be found from:

-------------------------------------------------------------------------------
nslookup 10.200.1.51
51.1.200.10.in-addr.arpa name = AdGuardDNS2.example.com.
tjharman commented 3 months ago

That nslookup you're doing is only querying your .50 server If you force nslookup to query .51 I bet you get the reverse results.

iptvcld commented 3 months ago

Before I made the change - I did query both AGH IP's. The output shown above is one for .50 and the other for .51 just doing a normal nslookup and only the .50 was returning the 2 records using this command.

I know using the dig commands you provided did indeed show both servers have 2 records each but it was just odd that when performing the above nslookup that only the .50 was showing 2 records.

tjharman commented 3 months ago

This is because nslookup is only querying you .50 server. You were never querying your .51 server with nslookup.

tjharman commented 3 months ago

If you revert your change and do

nslookup 10.200.1.51 10.200.1.51 (which will force nslookup to query your .51 server) you'll see what I mean.

You were only ever querying .50, which is why you only saw it on one side, you wery only querying 1 side.

iptvcld commented 3 months ago

Thank you, i now get it! I reversed the changes and can see that it was the same on the 2nd server as well...

Thanks for your guidance on that config change hostsfile_enabled: false

tjharman commented 3 months ago

Excellent, good stuff. Closing this ticket.