Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adguard home DNS rewrites not functioning with DHCP server enabled #4865

Closed
3 tasks done
anaander opened this issue Aug 28, 2022 · 6 comments
Closed
3 tasks done

Adguard home DNS rewrites not functioning with DHCP server enabled #4865

anaander opened this issue Aug 28, 2022 · 6 comments

Comments

@anaander
Copy link

Prerequisites

  • I have checked the Wiki and Discussions and found no answer

  • I have searched other issues and found no duplicates

  • I want to report a bug and not ask a question

Operating system type

Linux, Other (please mention the version in the description)

CPU architecture

AMD64

Installation

Docker

Setup

On one machine

AdGuard Home version

v0.107.11

Description

What did you do?

Created multiple DNS rewrites for hosts in the local IPs space in this format hostname.local.lan

Expected result

I can lookup the hosts

Actual result

I can only lookup the hosts with the DHCP server disabled

Screenshots (if applicable)

Additional information

lookup with DHCP disabled

.\doggo.exe cable.local.lan -n 10.0.0.206
NAME TYPE CLASS TTL ADDRESS NAMESERVER
cable.local.lan. A IN 10s 192.168.100.1 10.0.0.206:53

lookup with DHCP enabled

.\doggo.exe cable.local.lan -n 10.0.0.206
NAME TYPE CLASS TTL ADDRESS NAMESERVER STATUS
cable.local.lan. SOA IN 10s fake-for-negative-caching.adguard.com. 10.0.0.206:53 NXDOMAIN
hostmaster.cable.local.lan. 100500
1800 900 604800 86400

@anaander
Copy link
Author

anaander commented Aug 30, 2022

More about this; sort of "found a solution" but I'd still call it a bug.

Since my internal domain is "local.lan" I had to set the dhcp.local_domain_name to something else (in my case I just put in client.lan)

This allowed me use DNS rewrites for local.lan with DHCP enabled.

I also had to add

dhcp.dhcpv4.options:
- 15 hex 6C6F63616C2E6C616E

which pushed the actual domain name down to the clients when they lease an IP.

It also means the clients FQDN is registered with the incorrect domain when the IP is leased and a manual rewrite needs to be written for them to work properly.

@ainar-g ainar-g self-assigned this Sep 1, 2022
@ainar-g ainar-g added the needs investigation Needs to be reproduced reliably. label Sep 1, 2022
@ainar-g ainar-g added this to the v0.107.12 milestone Sep 1, 2022
@ainar-g
Copy link
Contributor

ainar-g commented Sep 1, 2022

Hello. Just to be clear, can you provide an example of the filtering rule you're applying? Or do you mean the Filters → DNS rewrites ones?

@anaander
Copy link
Author

anaander commented Sep 1, 2022

In AdGuardHome.yaml

user_rules:
  - '||pa-vm.local.lan^$dnsrewrite=NOERROR;A;10.0.0.248'
  - '||248.0.0.10.in-addr.arpa^$dnsrewrite=NOERROR;PTR;pa-vm.local.lan.'
dhcp:
  enabled: true
  interface_name: eth0
  local_domain_name: client.lan
  dhcpv4:
    gateway_ip: 10.0.0.254
    subnet_mask: 255.255.255.0
    range_start: 10.0.0.100
    range_end: 10.0.0.180
    lease_duration: 604800
    icmp_timeout_msec: 1000
    options:
      - 15 hex 6C6F63616C2E6C616E

Setting local_domain_name to 'local.lan' and enabling dhcp causes the custom filter to fail. Setting it to anything else (client.lan in this case) makes them to work.

@ainar-g
Copy link
Contributor

ainar-g commented Sep 1, 2022

I see, thanks! As a workaround, you could probably add a static lease with this IP and hostname. We'll see what we're able to do here.

@ainar-g ainar-g added enhancement P3: Medium and removed needs investigation Needs to be reproduced reliably. labels Sep 1, 2022
adguard pushed a commit that referenced this issue Sep 2, 2022
Updates #4865.

Squashed commit of the following:

commit b874088
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Sep 2 14:01:52 2022 +0300

    dnsforward: imp code, docs

commit a1b95fd
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Sep 1 19:37:45 2022 +0300

    all: refactor dns handler; opt
adguard pushed a commit that referenced this issue Sep 2, 2022
Updates #4865.

Squashed commit of the following:

commit b26575b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Sep 2 16:47:25 2022 +0300

    dnsforward: imp code, docs, logs

commit c60942c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Sep 2 16:24:44 2022 +0300

    dnsforward: process unknown queries in dhcp domain
@ainar-g
Copy link
Contributor

ainar-g commented Sep 2, 2022

@anaander, the most recent build on the Edge channel includes a fix for this. Could you please check if it works for you?

@anaander
Copy link
Author

anaander commented Sep 2, 2022

Switched my docker container over to adguard/adguardhome:edge image and changed the dhcp.local_domain_name to local.lan and the custom rules are now working with DHCP enabled.

Can confirm that the fix works. Thank you.

@ainar-g ainar-g closed this as completed Sep 2, 2022
heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Updates AdguardTeam#4865.

Squashed commit of the following:

commit b874088
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Sep 2 14:01:52 2022 +0300

    dnsforward: imp code, docs

commit a1b95fd
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Sep 1 19:37:45 2022 +0300

    all: refactor dns handler; opt
heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Updates AdguardTeam#4865.

Squashed commit of the following:

commit b26575b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Sep 2 16:47:25 2022 +0300

    dnsforward: imp code, docs, logs

commit c60942c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Sep 2 16:24:44 2022 +0300

    dnsforward: process unknown queries in dhcp domain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants