[Pdns-users] Different responses based on client IP (not geo)

Johannes Ernst johannes.ernst at gmail.com
Sat Aug 23 05:08:45 UTC 2014

I'd like to do this:
    1. If a client queries from a particular subnet, an A record query for foo.example.com returns something (say
    2. If a client queries from somewhere else, an A record query for foo.example.com returns something else (say

It's sort of like the geo backend, but not quite, because no actual geography is involved. Can this be done? And if so, how?

Example scenario:

foo.example.com is a host running on Amazon EC2. If a client also runs on EC2 in the same data center, return the "private" IP address for foo.example.com.
If anybody else in the world asks, return the "public" IP address.

That way, EC2-internal communication does not need to go through their public routers, and does not incur the performance overhead nor the bandwidth charges.

Perhaps I could essentially create an "This Amazon data center country", and a "everywhere else" default, and use the geo backend?

Would love some pointers if somebody has done this before.



More information about the Pdns-users mailing list