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.

I have to manage two domains : compagny.com copagny.bigcompagny.com

I use Bind9 on Debian Lenny.

I want to use one Zone file for both domains.

  • If I ask for server.compagny.com, it will give me address 10.0.0.1
  • If I ask for server.compagny.bigcompagny.com, it will give me the same address 10.0.0.1

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

How can I do that ?

Thx

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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

zone "example.com" IN {
    type master;
    file "example.com";
};

zone "subsidiary.example.com" IN {
    type master;
    file "example.com";
};

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 ns1.example.com. hostmaster.example.com. 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

 
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.