AdguardTeam / AdGuardHome

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

[Feature Request] Conditional Forwarding Option #1622

Open davidmerrique opened 4 years ago

davidmerrique commented 4 years ago

Problem Description

Client names do not show up in any logs. (I'm not using AdGuard Home as my DHCP server)

Proposed Solution

We should have an "Conditional Forwarding" option

Alternatives Considered

This could be similar to what Pi-hole offers:

Screen Shot 2020-04-25 at 8 33 50 PM

Additional Information

With this option, Pi-hole displays friendly client names, even when it's not configured as my DHCP server.

ameshkov commented 4 years ago

Hm, what's the point of forwarding anything?

As I recall, DHCP requests are broadcasted so they will reach the DHCP server regardless of whether it's forwarded or not.

davidmerrique commented 4 years ago

@ameshkov You're saying that there shouldn't be any need for this and AdGuard Home should hear from the DHCP server and know all the client names?

It doesn't seem to know any client names though. And if that's the case, why would Pi-hole need this option then?

(Sorry, I'm not well versed in networking 😅)

Thanks

emlimap commented 4 years ago

This is something you can do with upstream DNS under Settings -> DNS Settings.

Below are the rules that I have since my router acts as DHCP server. Tailored to the info from your screenshot

[/local/]192.168.0.1
[/0.168.192.in-addr.arpa/]192.168.0.1

First rule is so that you can lookup .local domain and second one allows you to do reverse lookups against 192.168.0.x IP addresses

ameshkov commented 4 years ago

You're saying that there shouldn't be any need for this and AdGuard Home should hear from the DHCP server and know all the client names?

Well, basically, yes. We don't do that because it's unclear when exactly the client will send the next DHCP request so it may take quite some time to get the client's hostname.

Instead of that AdGuard Home scans ARP table every time a new client makes a DNS query. This way we can also get clients hostnames, but it's a little bit more manageable.

rodalpho commented 4 years ago

I had this same problem and addressed it by adding all my local domains in HOSTS file format under Custom Filtering Rules. So it is possible to hardcode them now, but I agree it would be helpful to have local domains automatically resolve.

ameshkov commented 4 years ago

@rodalpho well, as @emlimap said, you can achieve that by making AdGuard Home query your router for local domains.

rodalpho commented 4 years ago

I didn't read emlimap's comment sufficiently closely.

AGH already has conditional forwarding with his instructions!

davidmerrique commented 4 years ago

@emlimap Brilliant. And I just found it in the wiki https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration#specifying-upstreams-for-rdns

@ameshkov Seems like this is my solution, we can probably close this now. But do you think this should be displayed more prominent in the readme?

ameshkov commented 4 years ago

But do you think this should be displayed more prominent in the readme?

Hmm, maybe we should instead provide a simple setting that will configure upstreams that way?

rodalpho commented 4 years ago

That would definitely be preferable, as it's a bit fiddly to set it up now.

I would also document it more clearly though; I have multiple VLANs and needed to add them all to get reverse resolution working properly. I don't expect any built-in GUI switch to handle such a complex configuration, but docs would make it easier to figure out on my own.

ameshkov commented 4 years ago

Hm, what would you like us to add to the doc?

rodalpho commented 4 years ago

Just simple examples would make sense to me.


Examples assume your router IP is 192.168.1.1 and your local address range is 192.168.1.*.

Query your router for all hostnames not containing a period and reverse-resolution for your 192.168.1.* network: [///1.168.192.in-addr.arpa/]192.168.1.1

Additionally query the router for names ending in .local and .yourdomain.com: [///1.168.192.in-addr.arpa/local/yourdomain.com/]192.168.1.1

And if you also run a 192.168.2.* VLAN: [///1.168.192.in-addr.arpa/2.168.192.in-addr.arpa/local/yourdomain.com/]192.168.1.1

davidmerrique commented 4 years ago

@ameshkov @rodalpho I think just simple examples would be great.

Clearly saying that you can do this so AdGuard Home automatically queries & displays client hostnames. And perhaps some more advanced examples dealing with VLANs.

Maybe this could even be automatic? During setup it could ask for the router IP and add the proper lines to "Upstream DNS servers".

rodalpho commented 4 years ago

I think it would make a lot of sense to automatically grab the gateway and use that, wouldn't even need to ask the user anything. That would work for almost everybody out of the box.

FabioEight commented 4 years ago

I've tried the examples above:

[/fritz.box/]192.168.1.1
[/168.192.in-addr.arpa/]192.168.1.1

But on the clients list, I still see only the gateway or clients with DNS set manually.

rodalpho commented 4 years ago

That's a bug in the latest version of AGH.

Ref https://github.com/AdguardTeam/AdGuardHome/issues/1719

fermulator commented 1 year ago

Trying to catch up with the original spirit of this issue/request. Came here looking for the same solution, (DDG/Google for "Conditional Forwarding" as I am coming from pihole) .. did not as of yet see anything obvious in the configuration DNS screens

Looking into https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration#rdns-clients

Coming back to it though, I see section "Private reverse DNS servers" may actually offer what we are looking for now.