[dnsdist] Trafic redirect via ports

bert hubert bert.hubert at powerdns.com
Thu Mar 23 12:29:35 UTC 2017


On Thu, Mar 23, 2017 at 09:51:09AM +0100, Thibaud Dublé wrote:
> The first idea was to send traffic to the other dnsdist for "pool1" on port 5353 and traffic for "pool2" on port 5354,
> but it looks like it is impossible to add Pool Rules to a specific IP:port.

Hi Thibaud,

I am a bit confused. I think I know what you mean, but perhaps can you
clarify. 

> Ideally, the pool rule config would look like this :
>  
> bind1NMG = newNMG()
> bind1NMG:addMask("10.255.0.100/32")
> bind1NMG:addMask("10.255.1.100/32")
> bind1NMG:addMask("172.17.0.11:5353")

So you want to add source port selection to the rule?

Are you sure traffic will always come in from that source port? Usually that
is not the case as source ports tend to be dynamic.

If this is what you want, today you could do that with a Lua selection rule:
function luarule(dq)
        if(dq.remoteAddr:getPort()==5353) 
        then
                return DNSAction.Pool, "bind" 
        else
                return DNSAction.Pool, "bind2"    
        end
end

And then:
addLuaAction("172.17.0.11/32", luarule)

You may need to change this a little bit to compensate for typos or errors,
but this is the idea.

Good luck - if this really solves your problem we could make a direct rule
for it. Please let us know.

	Bert


More information about the dnsdist mailing list