-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Use strict order for upstreams #355
Comments
I also would like an option to configure the upstream policy. Maybe we could implement a configuration enum like:
This would mirror the first two options in adguard home. (I don't get the third option and never used it 😅) |
Current implementation was designed to combine privacy with performance:
We can provide additional "strategies", like strict, random or random weighted based on upstream resolver response time. |
Maybe we can also implement a "hyperlocal" mode: Blocky works as a recursive resolver and doesn't rely on any upstream resolver? That means blocky will recursively ask the corresponding name server and caches results. This will significantly improve the privacy, but is probably slow for queries with many subdomains. Any thoughts? |
What do you mean by "corresponding name server"? Do you mean something like Unbound? |
Yes, like unbound, but in blocky. In this case we can reuse blocky's cache and provide additional prometheus metrics. |
A few things I've observed when I used to use Unbound to query root name servers:
|
I don't think that it would be feasible to include a recursive dns server option. In my setup there are multiple unbound instances as upstream resolvers for blocky. |
I'm currently trying to migrate from Pi-Hole to Blocky, since it is much better suited for running on K8s, but this issue is currently blocking me from doing so, unless I'm missing another option. I want the LanCache DNS server to always be preferred if it is available. My current Setup, with Pi-Hole using strict order, looks like
With Blocky, I think currently the only options would be
or
with LanCache being a SPOF since both Blocky and Unbound have multiple replicas. |
@reitermarkus is that the Steam LAN thing? If so, it should not be a problem if LC answers queries faster than your other upstreams. |
Yes, it's for caching Steam games, among other things. Well, my other upstream is Unbound running in the same cluster, so it's quite likely that LanCache will not be significantly faster, if at all. |
I'm not sure about blocky, but I know AdGuard Home has a Fastest IP feature that does exactly what you want. |
Conditional DNS configuration (https://0xerr0r.github.io/blocky/configuration/#conditional-dns-resolution) could work if you can figure out which DNS names are used (steamcontent.com for example for steam, maybe others?) Did you try this approach? |
I had a look ad AdGuard Home before finding Blocky, but it has the same issue as Pi-Hole: No easy way to have multiple replicas.
That depends: Will conditional DNS fall back to using the default upstream when LanCache DNS is down? |
No, blocky will ask your lancache instance and if it returns NXDOMAIN, there is no fallback. Is it not the desired behaviour? Since lancache will either return the ip of local cache or the origin ip. |
The problem would be if LanCache is down, now I cannot resolve any cached domains. Basically, I want to be able to download game updates even if LanCache is down for whatever reason. Currently, this works by having LanCache as first DNS server, and if it is down, fall back to the next, i.e. downloads fall back to using the uncached upstream IP. |
Is this the way how pihole works? If one upstream DNS is down, it tries the second one (and not round-robin)? That means, if you query for example for "google.com", the pihole will ask you lancache instance first, does lancache return NXDOMAIN or will it resolve this query properly (by using some external resolver)? |
Not by default, but since it uses DNSmasq, I can configure it to use strict order.
LanCache will resolve it, using Unbound as upstream. And the same Unbound server acts as the fallback DNS server in Pi-Hole. So in case LanCache is running: Pi-Hole -> LanCache -> Unbound In case LanCache is down: Pi-Hole -> Unbound |
ok, got it. The requested "strict order resolution" will solve this challenge. With conditional mapping, you won't get the fallback resolution. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Hi all, I would like to contribute both the Where should we add the new |
That sounds good! 👍 Currently, we do have the "upstream" section and related "UpstreamTimeout". The "upstream" section is not a nested struct, but only a map (historical reasons). It would be better to have all upstream related configurations in a separate structure, but in this case we'll introduce breaking changes. So I think it would be better (for a moment) to introduce a new top-level config enum "upstreamStrategy" and refactor the "ParallelBestResolver" to extract the resolver choose logic for example in a separate interface. So we can implement more strategies later. |
I've got local changes to allow having more config there, and be back-compat. Basically I also renamed it to EDIT: so if you, @DerRockWolf, have already started some work, don't worry too much about the config, just add something to the big
Related to #1001 |
Bad weather gave me a bit of extra time today, so I opened #1086 with just the config change. |
@agneevX my PR (#1093) implementing the
The "upstream resolver" contacting the upstream DNS server only returns err if it didn't get a reply. The responses are returned as received, regardless of the DNS message response codes. This is also currently the case for the We would need to implement custom handling based on the DNS response codes. |
Currently blocky...
This works very well, but is not desirable when you want to use a known resolver as primary all the time and want to use a secondary resolver only as backup.
I propose adding an option to query the first resolver in the list, then falling back to secondary and so on... after any of the following:
upstreamTimeout
value maybe)REFUSED
is returned. Google does this for some queries containing ECS data. More on that issue here.The text was updated successfully, but these errors were encountered: