I want to conditionally resolve a DNS request based on incoming query.

Let's say I have 4 domains - www.a.com , www.b.com , www.c.com and www.d.com. As of now they are point to s.com using CNAME. Now based on some conditions (geo, time, etc), I want to point them to different servers.

For example, when s.com receives requests from a.com or b.com, it should point it s1.com and in the later cases to s2.com.

Is there a hosted solution for this, where I can define the rules or something. Will BIND work in this scenario ?

Thanks in advance.

  • What is the goal? Yes there are some DNS service providers that offer these types of services. I am not sure how they manage things behind the scenes but I know many do Geo-IP based DNS and some permit DNS schedules. – jeffatrackaid May 21 '13 at 21:07
  • I have couple of saas apps, e.g. qnahub.com. I want to divert the traffic to different instances based on different conditions. – Tushar May 21 '13 at 21:10

DNS is not not your best bet on this occasion for many reasons - like caching, propagation time etc.

Ideally you would use something to mange your your incoming traffic - like Stingray Traffic Manager or F5 Traffic Manager. Not only you will be able then to manage traffic based on conditions but also set redirects - like 301 (as the move will not be temporary). I have experience with Zeus/StingRay and those products offer exactly what you want.

  • Thanks Chris. Well, i need the redirects to be temporary. Moreover, I want it to be done through CNAME, so that the url in the browser doesn't change. I'll have a look at Zeus/StringRay. I will try and transfer the question to superuser, if possible. Thanks. – Tushar May 21 '13 at 22:01

I agree with Chris, but sticking to the actual question, in theory it can be done with BIND. I just wouldn't recommend it for anything outside of an extremely short term solution.

Set the TTLs for the specific records to zero (warning: some caching servers you don't operate may choose to ignore this and implement a minimum TTL) or some other very low number, and use views to control which version of s.com gets served based on source IP.

Note that views impact the entire domain, so unless you want to manage entirely different versions of the domain, you'll want to perform this on a subdomain. (i.e. have split views of foo.s.com, and a separate zone of s.com that does not have split views)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.