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
  • If I ask for server.compagny.bigcompagny.com, 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 ?


2 Answers 2


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
  • this line : @ IN SOA ns1.example.com. hostmaster.example.com. should stay the same ?
    – Kortex786
    May 17, 2010 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, 2010 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.

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.