AdguardTeam / AdGuardHome

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

Using AdGuard Home along with dnsmasq for local hosts name mapping #3063

Open nikallian opened 3 years ago

nikallian commented 3 years ago

Hi,

I just installed in my raspberry AdGuard home and so far I'm very satisfied. I just noticed a weird behavior comparing with my previous setup which was using dnsmasq as DNS caching and DHCP server.

I was using expand-hosts option to resolve some local clients using unqualified names instead of their IP. For example, I was able to ping a host using just a simple name (i.e. test) instead of its IP.

When I installed AdGuard I changed my setup of dnsmasq to do only IP-->hostname mapping to my local network hosts and setup accordingly the AdGuard (using the dnsmasq IP as upstream).

While I'm able to ping everything as before (using just a name) from my windows PC I have to add the "." suffix in order to find the host. For example

ping test. instead of ping test

I didn't have to do the same with dnsmasq and I'm wondering why.

Any idea?

Thanks in advance!

ainar-g commented 3 years ago

Hello. Could you please add the following information:

  1. Can you show us your [anonymised] upstream configuration? Either as plain text or as a screenshot.
  2. Do these hosts like test show up on the “Client settings” page? An anonymised screenshot also would be useful.

Thanks!

nikallian commented 3 years ago

Hi!

thanks for your reply and sorry for the late reply from my side.

This is a screenshot from the upstream servers (the private IP is the dnsmasq server running on the same raspi where AdGuard is installed but in different port.)

image

I have also setup the reverse DNS server but I'm not sure if this is required.

image

Yes test (actually is a real host in my private network, a raspberry PI destined for testing purposes) exists in the clients page.

image

Thanks in advance for your time. Kind Regards

ainar-g commented 3 years ago

Thanks for the thorough response. It seems like Windows's ping automatically adds .local TLD unless you add a dot in there to make it look like an FQDN. I'm not sure if there is a better solution, but you can add this in your Custom filtering rules:

||test.local^$dnsrewrite=NOERROR;CNAME;test

You could also try adding this rule for .local upstreams:

[/local/]192.168.2.11:5353

Please let us know if that helps.

nikallian commented 3 years ago

Hi!

thanks for your prompt reply!

Custom rule didn't work the same with the upstream.

There is a interesting remark here. I noticed that the linux hosts (raspberrys) reply to the ping from the windows machine even without the dot(.). At the same time, there is another one raspberry running a light version of linux that doesn't. The other hosts (IP cameras, routers e.t.c.) reply only if there is a dot(.) at the end of their name. Again, I don't understand why dnsmasq setup worked without the dot.

I'm also attaching the dnsmasq conf for you references and checking.

port=5353
listen-address=127.0.0.1
listen-address=192.168.2.11
bind-interfaces

address=/test/192.168.2.230
address=/radio/x.x.x.x
address=/rpi3/x.x.x.x
address=/corridor/x.x.xx
address=/backyard/x.x.x.x
address=/saloon/x.x.x.x
address=/stairs/x.x.x.x
address=/tplc/x.x.x.x
address=/adsl/x.x.x.x
address=/pc/x.x.x.x
address=/kodi/x.x.x.x
address=/rpi1/x.x.x.x

Thanks in advance for your time and help.

Kind Regards

ainar-g commented 3 years ago

Sorry for the bot misbehaving and for the long silence. Unfortunately, I really can't think of any ways to work around this, if the $dnsrewrite didn't work.

For now, the best I can do is mark this issue as needs-help and also probably document this WIndows' nslookup peculiarity somewhere.

nikallian commented 3 years ago

It's OK, I haven't looked into it for a long time now. It's working as it is even with the .(dot) following the name. Maybe in the future I will review every bit of my setup in hope that I will find something's wrong.

Thanks!