8

In BIND 9 (named), is there any way to return different A records depending on the asker's IP address?

When receiving a query for a certain DNS name, I'd like to return external IP address for the queries received from the outside world, and internal IP address for the queries received from the internal subnet.

Update:

Views seem to work OK, but there are about 300 records in the zone file.

Should I copy the whole file (and manage two files from now on) if I only want a single DNS record to be returned differently?

  • Why copy? A site with 300 records certainly did not enter them by hand. They are probably generated automatically from the provisioning database, no? So, Generating them twice is not a big deal. – bortzmeyer Jun 4 '09 at 10:19
11

BIND 9 has a feature to do exactly that, called "views".

There is a good article about how to use them on O'Reilly.

http://www.oreillynet.com/pub/a/oreilly/networking/news/views_0501.html

| improve this answer | |
  • There are about 300 records in the zone file. Should I copy the whole file (and manage two files) if I only want a single DNS record to be returned differenty? – Quassnoi Jun 2 '09 at 10:37
  • 5
    I would suggest creating a new zone within your view for that single record. The zone will be the full address of the record you wish to override and will contain only an SOA and an @ record. This should prevent any unnecessary duplication whilst keeping BIND authoritative, as usual, for the rest of the domain. – Dan Carley Jun 2 '09 at 11:20
  • No need to copy, BIND can include a zone file and therefore saves you typing (or programming). – bortzmeyer Jun 4 '09 at 10:18
2

For your future reference and for searching purposes this is known as "split horizon dns" It is supported in many DNS packages, including Djbdns.

| improve this answer | |
1

Yes, you can use views, which are basically a wrapper around your config that limit the configuration to only a certain segment of client IPs.

| improve this answer | |

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.