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

Prefer IPv4/6. However, it does not affect the resolution of pure IPv6/4 domain names. #5919

Open
3 tasks done
57382 opened this issue Jun 21, 2023 · 12 comments
Open
3 tasks done

Comments

@57382
Copy link

57382 commented Jun 21, 2023

Prerequisites

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

  • I have searched other issues and found no duplicates

  • I want to request a feature or enhancement and not ask a question

The problem

prefer_ipv4 and prefer_ipv6 are two operations. In the following, for the convenience of expression, only prefer_ipv4 is taken as an example. prefer_ipv6 is the same.
prefer_ipv4 Allows downstream clients to use IPv4 first when they support dual-stack. When prefer_ipv4 processes an AAAA request, it will automatically send an A request to test whether the domain name is dual-stack, and the newly generated A request will continue to execute subsequent rules together with the original AAAA request. If both A and AAAA requests get IP (the domain name is dual-stack) at last, the original AAAA request will be blocked.

Proposed solution

@ainar-g
reference https://irine-sistiana.gitbook.io/mosdns-wiki/mosdns-v5/ru-he-pei-zhi-mosdns/sequence-cha-jian#prefer_ipv4-6

Alternatives considered and additional information

No response

@57382
Copy link
Author

57382 commented Jun 21, 2023

I want to use prefer_ipv6. Currently AdGuardHome is only able to brute force disable ipv6, which is not what I want.
In my network, ipv6 is 3 times faster than ipv4. I'm talking about 3x the bandwidth.
That's why I don't want a ipv4.

@57382
Copy link
Author

57382 commented Jun 21, 2023

Some backward websites only support IPv4. Therefore, IPv4 cannot be simply turned off.

@fernvenue
Copy link
Contributor

Duplicate of #4482.

@57382
Copy link
Author

57382 commented Jun 21, 2023

Duplicate of #4482.

*$dnstype=A,dnsrewrite=NOERROR
This will kill all A. This will kill all IPv4.

||internal.my-campus.edu^$dnstype=A,dnsrewrite=NOERROR
This is not done automatically. Not as smart as prefer_ipv6.
So this is also useless.

Some applications lack settings and they ignore the operating system's configuration.
Therefore, it is necessary to implement this function in the DNS resolver.

@ainar-g
Copy link
Contributor

ainar-g commented Jun 21, 2023

@57382, I do not understand your request, sorry. The only preference we currently have is dns.bootstrap_prefer_ipv6, and it merely affects how the IP addresses for DNS servers are sorted.

@ainar-g ainar-g added the waiting for data Waiting for users to provide more data. label Jun 21, 2023
@57382
Copy link
Author

57382 commented Jun 21, 2023

@57382, I do not understand your request, sorry. The only preference we currently have is dns.bootstrap_prefer_ipv6, and it merely affects how the IP addresses for DNS servers are sorted.

@ainar-g

I want to add the following functionality:
Suppose a domain name has both A records and AAAA records.
This feature was added to allow forcing only AAAA records to be returned. This is achieved by deleting the A record. So it is mandatory.
This feature is only available for domain names that have both A records and AAAA records.
If there is only an A record for a domain name and no AAAA record, the A record will not be deleted and the A record will remain. This will avoid losing access to the domain if the A record is deleted.

vice versa. If I want to force only A records to be returned, the AAAA records are removed, but disabled for domains that only have AAAA records.

Another open source resolver, MOSDNS, has the above functions. MOSDNS uses the parameters prefer_ipv6 and prefer_ipv4 to achieve the above behavior.
I wish AdGuardHome would do the same, instead of just brute force removing all A's or AAAA's, which would break a lot of domains. It is extremely cumbersome to use rules for each domain name.

You can refer to this part of code of MOSDNS, implemented for AdGuardHome.
https://github.com/IrineSistiana/mosdns

@ainar-g
Copy link
Contributor

ainar-g commented Jun 21, 2023

I see. That would require us to essentially either query upstreams for both A and AAAA for a domain whenever one is queried or keep (and refresh) a list of domains which have one, both, or neither. I'm not sure if this is a common enough need to implement it. Whether to use AAAA results or the A ones is usually up to DNS clients.

@ainar-g ainar-g removed the waiting for data Waiting for users to provide more data. label Jun 21, 2023
@57382
Copy link
Author

57382 commented Jun 23, 2023

I see. That would require us to essentially either query upstreams for both A and AAAA for a domain whenever one is queried or keep (and refresh) a list of domains which have one, both, or neither. I'm not sure if this is a common enough need to implement it. Whether to use AAAA results or the A ones is usually up to DNS clients.

As a client application it knows nothing. Sometimes one needs to override the behavior of the client application. It is beneficial to implement this functionality. It doesn't do any harm. Black and white list mode is also available for this purpose. This increases compatibility from 99% to 100%. Works on all sites. Accelerate the network silently.
Details about implementing this functionality. Never use the domain name rule list method. Manually maintaining a list of domain name rules is very tedious. There are hundreds of millions of domain names on the Internet. The list of domain names should be used as a supplementary means in the form of black and white lists. rather than the implementation method for this functionality.
Both should be queried at the same time. Allows users to customize the setting of a synchronization query parameter to specify how many seconds to wait. You can also use caching. Only one of them is cached. The above methods can be combined. This process must be fully automatic.
The future belongs to IPv6, the future belongs to AdGuardHome. Just like HTTPS only. @ainar-g

@fernvenue
Copy link
Contributor

fernvenue commented Jun 23, 2023

So what about CNAMEs? What if the application require and only requests A but the domain also has AAAA results? I think it should be the behavior of the system and application itself, and AdGuardHome should do its own thing, just as I said #4482 (comment) here.

By the way, as @ainar-g said above:

Whether to use AAAA results or the A ones is usually up to DNS clients.

That's exactly what I meant.

@57382
Copy link
Author

57382 commented Jun 23, 2023

So what about CNAMEs? What if the application require and only requests A but the domain also has AAAA results? I think it should be the behavior of the system and application itself, and AdGuardHome should do its own thing, just as I said #4482 (comment) here.

By the way, as @ainar-g said above:

Whether to use AAAA results or the A ones is usually up to DNS clients.

That's exactly what I meant.

The client application should serve me from start to finish. The DNS client app is usually alive, but if he's killing himself, I'll stop it! And you will silently watch him die. This is what makes us different.

I can't watch stupid things happen. You seem to be able to.

There is nothing special about CNAME. Use blacklists and whitelists to rule out any problematic domains. CNAME is in it. So CNAME won't break anything.

AdGuardHome has done a lot. Is DNSCrypt V2 support something an ad filter should do? no way. What about speed testing against resolved IP? AdGuardHome has already done it. It seems like this IP speed test feature should be removed, prompting AdGuardHome to grow into a pure ad filter. you're right.

Being able to speed boost the network makes AdGuardHome more competitive among its peers.

@ainar-g
Copy link
Contributor

ainar-g commented Jun 23, 2023

Please keep discussions about the future to the Discussions section. We'd like to keep the Issues section on-topic.

@badgv
Copy link

badgv commented Apr 16, 2024

This is a very good suggestion. Just like mosdns, dual-stack domain names can only return IPV4/IPV6, but it does not affect pure IPV4/IPV6 domain names.

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

4 participants