[dnsdist] Matching DNS server IP in request

Michel Otte michel at cybox.nl
Tue May 21 07:22:09 UTC 2024


Hi Ales,

Just setup two Server pools A & B with their own cache, then use a LuaRule
<https://dnsdist.org/reference/selectors.html#LuaRule> / LuaFFIRule
<https://dnsdist.org/reference/selectors.html#LuaFFIRule> and write a Lua
function that will get a DNSQuestion <https://dnsdist.org/reference/dq.html>
object when called and use the localaddr
<https://dnsdist.org/reference/dq.html#DNSQuestion.localaddr> attribute to
filter on the local IP address the request was received on. The Lua
function should return true when the particular IP is matched. Then use
PoolAction("<poolname>")
<https://dnsdist.org/reference/actions.html#PoolAction> to direct the
packets that are received on that particular IP to the desired pool.

The easiest way to achieve this is to assign one IP address to be the
"default" destination though, and only set up a specific pool and rule for
the alternate IP address. Otherwise you'll have to maintain 2 Lua functions
and set up 2 rules.

Met vriendelijke groet,
Michel Otte
<https://www.cybox.nl/>
Spoorstraat 55k <https://www.cybox.nl/>
5831 CJ Boxmeer <https://www.cybox.nl/>

0485-471774 <0485471774>
www.cybox.nl


Op vr 17 mei 2024 om 18:18 schreef Aleš Rygl via dnsdist <
dnsdist at mailman.powerdns.com>:

> Hello,
>
>      I would need to virtualy split a single dnsdist instance in the the
> way, that clients sendig request to a particular IP od DNS dnsdist
> (listening on multiple IPs) are sent to a dedicated pool. I could start
> another dnsdist process bound to the secondary IP on the server but I
> think there must be a more lelegant wa to do it ;-) It should work this
> way:
>
>      client1 ---> DNS req. to dnsdist IP1 ---> pool-A ---> cache-A --->
> backend A
>      client2 ---> DNS req. to dnsdist IP2 ---> pool-B ---> cache-B --->
> backend B
>
>      Is there a way to match a destination IP of the client's request in
> a rule in order to send it to a pool? I can not use client's IP here.
>
> Thanks for any ideas.
>
> Regards
>
> Ales
>
>
>
>
> _______________________________________________
> dnsdist mailing list
> dnsdist at mailman.powerdns.com
> https://mailman.powerdns.com/mailman/listinfo/dnsdist
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/dnsdist/attachments/20240521/32c02545/attachment.htm>


More information about the dnsdist mailing list