DNS rewrite rule is not working as expected. #3698

Closed
opened 2026-03-04 04:07:59 -05:00 by deekerman · 4 comments
Owner

Originally created by @hezhijie0327 on GitHub (May 27, 2022).

Have a question or an idea? Please search it on our forum to make sure it was not yet asked. If you cannot find what you had in mind, please submit it here.

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Issue Details

  • Version of AdGuard Home server:
    • v0.108.0-b.8
  • How did you install AdGuard Home:
    • Docker
  • How did you setup DNS configuration:
    • System
  • If it's a router or IoT, please write device model:
  • CPU architecture:
    • AMD64
  • Operating system and version:
    • Ubuntu 22.04

Expected Behavior

For example, example.org DNS record is 1.2.3.4. Use the following rewrite rules.

|example.org^$dnsrewrite=NOERROR;A;2.4.6.8
|example.net^$dnsrewrite=NOERROR;CNAME;example.org

The final answer of example.net is 1.2.3.4 not 2.4.6.8.

Actual Behavior

The final answer should be 2.4.6.8.

Screenshots

Screenshot:

Additional Information

Originally created by @hezhijie0327 on GitHub (May 27, 2022). Have a question or an idea? Please search it [on our forum](https://github.com/AdguardTeam/AdGuardHome/discussions) to make sure it was not yet asked. If you cannot find what you had in mind, please [submit it here](https://github.com/AdguardTeam/AdGuardHome/discussions/new). ### Prerequisites Please answer the following questions for yourself before submitting an issue. **YOU MAY DELETE THE PREREQUISITES SECTION.** - [X] I am running the latest version - [X] I checked the documentation and found no answer - [X] I checked to make sure that this issue has not already been filed ### Issue Details <!-- Please include all relevant details about the environment you experienced the bug in. If possible, include the result of running `./AdGuardHome -v --version` from the installation directory. --> * **Version of AdGuard Home server:** * v0.108.0-b.8 * **How did you install AdGuard Home:** * Docker * **How did you setup DNS configuration:** * System * **If it's a router or IoT, please write device model:** * <!-- (e.g. Raspberry Pi 3 Model B) --> * **CPU architecture:** * AMD64 * **Operating system and version:** * Ubuntu 22.04 ### Expected Behavior <!-- A clear and concise description of what you expected to happen. --> For example, `example.org` DNS record is `1.2.3.4`. Use the following rewrite rules. ``` |example.org^$dnsrewrite=NOERROR;A;2.4.6.8 |example.net^$dnsrewrite=NOERROR;CNAME;example.org ``` The final answer of `example.net` is `1.2.3.4` not `2.4.6.8`. ### Actual Behavior <!-- A clear and concise description of what actually happened. --> The final answer should be `2.4.6.8`. ### Screenshots <!-- If applicable, add screenshots to help explain your problem. --> <details><summary>Screenshot:</summary> <!--- drag and drop, upload or paste your screenshot to this area--> </details> ### Additional Information <!-- Add any other context about the problem here. -->
deekerman 2026-03-04 04:07:59 -05:00
  • closed this issue
  • added the
    duplicate
    label
Author
Owner

@ainar-g commented on GitHub (May 30, 2022):

Hello. AdGuard Home doesn't currently follow CNAME chains with dnsrewrite rules. You can mitigate that by adding the address of your AdGuard Home as the upstream for example.org:

[/example.org/]192.168.X.Y
@ainar-g commented on GitHub (May 30, 2022): Hello. AdGuard Home doesn't currently follow CNAME chains with `dnsrewrite` rules. You can mitigate that by adding the address of your AdGuard Home as the upstream for `example.org`: ```none [/example.org/]192.168.X.Y ```
Author
Owner

@hezhijie0327 commented on GitHub (May 30, 2022):

It's worked for most scenario. But if the rule contains a specific client, it will not effect.

|example.org^$client=CLIENT1,dnsrewrite=NOERROR;A;2.4.6.8
|example.net^$client=CLIENT1,dnsrewrite=NOERROR;CNAME;example.org

This will break the query from other clients. [/example.org/]192.168.X.Y this should be the work around solution, is there any plan to let dnsrewrite support it?

@hezhijie0327 commented on GitHub (May 30, 2022): It's worked for most scenario. But if the rule contains a specific client, it will not effect. ``` |example.org^$client=CLIENT1,dnsrewrite=NOERROR;A;2.4.6.8 |example.net^$client=CLIENT1,dnsrewrite=NOERROR;CNAME;example.org ``` This will break the query from other clients. `[/example.org/]192.168.X.Y` this should be the work around solution, is there any plan to let `dnsrewrite` support it?
Author
Owner

@ainar-g commented on GitHub (May 31, 2022):

You can use client-specific upstream settings for that. Although that might cause caching issues, see AdguardTeam/dnsproxy#169.

The CNAME chains will probably be implemented during #2499. I'll merge this feature request into that one.

@ainar-g commented on GitHub (May 31, 2022): You can use client-specific upstream settings for that. Although that might cause caching issues, see AdguardTeam/dnsproxy#169. The CNAME chains will probably be implemented during #2499. I'll merge this feature request into that one.
Author
Owner

@rfgamaral commented on GitHub (Nov 19, 2022):

@ainar-g Any plans on implementing this feature soon? The upstream dns work around doesn't work for me, because I need these rules to be applied to specific clients only, and not all of them.

@rfgamaral commented on GitHub (Nov 19, 2022): @ainar-g Any plans on implementing this feature soon? The upstream dns work around doesn't work for me, because I need these rules to be applied to specific clients only, and not all of them.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AdGuardHome#3698
No description provided.