Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to manage two domains :

I use Bind9 on Debian Lenny.

I want to use one Zone file for both domains.

  • If I ask for, it will give me address
  • If I ask for, it will give me the same address

I don't want to create twice the same files for my DNS Server : Too hard to maintain.

How can I do that ?


share|improve this question
up vote 5 down vote accepted

Just list the same file twice in your named.conf:

zone "" IN {
    type master;
    file "";

zone "" IN {
    type master;
    file "";

However - you'll have to be clever with the contents of your zone file:

  1. Don't include a $ORIGIN statement - it's implicit from the config file
  2. Use '@' to refer to the implicit $ORIGIN
  3. Use relative domain names (not FQDNs) as appropriate.
  4. Use FQDNs when it actually matters which domain is returned
share|improve this answer
this line : @ IN SOA should stay the same ? – Kortex786 May 17 '10 at 12:31
That's up to you - you could just use @ IN SOA ns1 hostmaster ( ... ), and then the $ORIGIN will be automatically appended, giving you the "right" SOA for each domain. That's covered by items #3 and #4 above. – Alnitak May 17 '10 at 12:39

You can have one zone for for multiple domains by specifying the same zone file for each domain in named.conf. However, the examples you give aren't domains, they're hosts. The only way I can see to do that easily is with wildcards. Any other way is far harder to maintain than simply having separate zone files.

share|improve this answer

Your Answer


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.