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

Multiple dns servers #6

Closed
cdekok opened this issue Aug 20, 2014 · 3 comments · Fixed by #180
Closed

Multiple dns servers #6

cdekok opened this issue Aug 20, 2014 · 3 comments · Fixed by #180

Comments

@cdekok
Copy link

cdekok commented Aug 20, 2014

It would be nice if it was possible to add multiple dns servers

@WyriHaximus
Copy link
Member

@clue You think this would be hard to do? We could let two servers race and use the first answer.

Refs: beyondcode/laravel-websockets#31 (comment) by @mpociot

@clue
Copy link
Member

clue commented Jan 29, 2019

@WyriHaximus: @clue You think this would be hard to do? We could let two servers race and use the first answer.

I agree, implementation-wise this wouldn't be too much work. Instead of concurrently sending a query to multiple DNS servers, there are a number of different strategies that are commonly used in practice, for instance:

The algorithm used is to try a name server, and if the query times out, try the next, until out of name servers, then repeat trying all the name servers until a maximum number of retries are made.
[…]
rotate

sets RES_ROTATE in _res.options, which causes round-robin selection of nameservers from among those listed. This has the effect of spreading the query load among all listed servers, rather than having all clients try the first listed server first every time.

See https://linux.die.net/man/5/resolver

@WyriHaximus: Refs: beyondcode/laravel-websockets#31 (comment) by @mpociot

The way I understand the referenced ticket, it looks like this might in fact be unrelated to this feature. On Mac you can use /etc/resolver/* files to set up different DNS settings/nameservers for certain domains (http://www.manpagez.com/man/5/resolver/). I'm not aware of any similar mechanism on other platforms (check man page above). This appears to be commonly used for "development domains" and/or split-horizon DNS setups. On other platforms, this is often handled by having a (local) DNS resolver (stub) taking care of this configuration.

This ticket hasn't received much attention simply because it's not too common to have a setup that relies on this in practice. Having DNS fall back to secondary DNS servers incurs a significant delay for all DNS lookups, so you usually should ensure your primary DNS servers is reachable. In a failover scenario this might be useful as a backup, but even then there are multiple alternative solutions. For instance, on systemd-enabled systems your local DNS stub takes care of this and you only have to query this as your primary DNS server.

As such, there are currently no immediate plans to build this from my end (no demand at the moment and more important outstanding issues currently), but I guess we would be really happy to accept PRs 👍

@WyriHaximus
Copy link
Member

As such, there are currently no immediate plans to build this from my end (no demand at the moment and more important outstanding issues currently), but I guess we would be really happy to accept PRs +1

Might have a use case for it soon 😎

WyriHaximus added a commit to WyriHaximus-secret-labs/dns that referenced this issue Jul 23, 2019
Currently this component only supports a single DNS server so with reactphp#6
in mind I started working on adding multiple server support. But ran
into the issue that if the first server on the list isn't responding it
takes a while before falling over the the next server in the list. So
with my work on reactphp/socket#196 in mind and
specifically the basic principle of
https://tools.ietf.org/html/rfc8305#section-3.1 the work shifted to
sending the queries out with a delay between them rather then waiting
for the first server to fail/succeed. On the plus side records will
resolve faster when a server in the list is failing. On the down side it
 will send more queries thus generating a bit more network traffic.
@clue clue added this to the v1.3.0 milestone Aug 14, 2019
@clue clue removed this from the v1.3.0 milestone Jul 10, 2020
@clue clue added this to the v1.7.0 milestone Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants