0

This is specifically for my domain, the users/visitors will not use my dns server at all. Is this even possible?

I need to setup a dns server that I can host my domain on, that when requested will choose an IP address for the user from criteria that I set on my server.

Ex: user from Canada requests A NAME record lookup on mydomain.com and it will return 10.0.0.20 and a user from the Netherlands performing the same lookup will return 10.0.0.21, ideally I would like to be able to take the requesting IP address (user) and run my own scripts/checks on it even down to accounting for the ASN of the requestee and giving a specific IP address. Is this possible with hosting my own DNS server?

I don't have much experience outside of using free or third party dns services.

This needs to be done at the DNS level and not through redirecting traffic using a reverse proxy.

2

The base functionality for returning different results based on the client IP-address is in jargon called split horizon DNS and offered by many dns servers.

The specific use case of using a Geo IP library to return different records based on the location associated with a client ip-address is found in some DNS servers, for instance in PowerDNS the "Geo IP" back-end provides that out-of-the-box and in other commercial and open source DNS servers similar functionality is sometimes called "GEO DNS" or more descriptive terms like "global [DNS] load balancing" or "[global] traffic director" may be used.

If you want to create your own scripts, off-hand I know that both DNSmasq and PowerDNS provide hooks for LUA scripts to create your own logic.

0

Yes, this is, at most basic, possible, depending on your DNS server software. The feature in Bind is called "views" and allows you to manage different resulting configurations to present based on who is asking. This is also called "split" DNS.

The implementation varies based on your server. For official reference, see latest Bind docs. [1]

Performing dynamic scripting in-line with DNS lookup is not a feature of Bind, or most DNS servers. If you can choose your destination based on subnets, this will work for you.

1: https://ftp.isc.org/isc/bind9/cur/9.13/doc/arm/Bv9ARM.ch05.html#view_statement

  • Thank you! This is a good direction that I will investigate for my uses. If it helps, I had in my mind the idea of wrapping a custom script in something like python that takes the requestee's ip address and does lookups/blacklist checks and returning a predefined ip address depending on what my script dictates. I was able to do such with http using OpenRESTY/NGinx but my use now requires dns level checks. – zenzenmann Apr 1 at 6:13
  • edited while you were commenting to clarify that scripting isn't a feature, to the best of my knowledge. :) – rjewell Apr 1 at 6:16

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.