[Pdns-users] Split Horizon via lua

Daniel L. Miller dmiller at amfes.com
Wed May 9 02:26:57 UTC 2012


I have a split horizon setup working just fine - but I don't know if 
there's a more "elegant" way of doing it.  At the moment, my lua script 
is a long if...elseif construct for all the domains hosted locally.

function preresolve ( requestorip, domain, qtype )
     if string.find( domain, "domain1.com." ) and qtype == pdns.A then
         return 0, { { qtype=pdns.A, content="192.168.0.4" } }
     elseif string.find( domain, "domain2.com." ) and qtype == pdns.A then
         return 0, { { qtype=pdns.A, content="192.168.0.4" } }
     elseif string.find( domain, "domain3.com." ) and qtype == pdns.A then
         return 0, { { qtype=pdns.A, content="192.168.0.4" } }
     else
         return -1, {}
     end
end

Is there a "better" way?
-- 
Daniel



More information about the Pdns-users mailing list