Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

3 Answers 3

up vote 11 down vote accepted

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

share|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
    
@Dan: Nice idea, thanks! –  Quassnoi Jun 2 '09 at 11:32
    
No need to copy, BIND can include a zone file and therefore saves you typing (or programming). –  bortzmeyer Jun 4 '09 at 10:18
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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