How to use BIND DNS with multiple domain names

binddomain-name-systemsubdomainwindows-xp

I am trying to set up a simple local DNS server to use across multiple virtual machines in a dev/test environment (web servers). While I would just set up a Windows server with DNS, I have limited memory available so I would rather just run BIND on my host OS (Widows XP Pro).

I found this great tutorial that got me up and running with BIND on a single domain. After the setup I was able to use my knowledge of DNS control panels that I am used to to set up a few records. Unfortunately, the assumption in the tutorial was that I would only want to manage DNS for one domain and I have two domains.

I have been through tons of documentation and I have tried duplicating the zone file and copying and pasting the "zone" section in named.conf, but that didn't work. I also tried putting the other domain's records right into my original zone file without success. Following the example, my zone file currently looks like this:

$TTL 6h
@   IN SOA  ns1.mydomain.com.   info.mydomain.com. (
            2011052302
            10800
            3600
            604800
            86400 )

@       NS  ns1.mydomain.com.

ns1 IN A    10.225.0.51

test    IN A    10.225.0.1

$ORIGIN test.mydomain.com.
www IN A    10.225.0.1
www2    IN A    10.226.0.66

This currently resolves for:

  1. test.mydomain.com
  2. www.test.mydomain.com
  3. www2.test.mydomain.com

I need to also make the server resolve:

  1. test.myotherdomain.com
  2. www.test.myotherdomain.com
  3. ftp.test.myotherdomain.com

I am not interested in how many ways it can be achieved or best practices (this is a test enovironment), I am just trying to find 1 way to get it to resolve records for both mydomain.com and myotherdomain.com. If it can be done in 1 zone file, that is fine. If it requires multiple zone files, please explain how to configure them (following the tutorial I linked to) so they will be read by BIND.

Update

Through more tinkering and help from you guys I discovered where I went horribly wrong – I was having conflicts with the public DNS because both mydomain.com and myotherdomain.com are online. I had the file structure and named.conf set up correctly before. However, I had to set up my local DNS to be authoritive for test.mydomain.com and test.myotherdomain.com (vs mydomain.com and myotherdomain.com) and then put in the A records only for the "test" subdomain.

$TTL 6h

@   IN SOA  ns1.test.mydomain.com.  info.mydomain.com. (
            2011052304
            10800
            3600
            604800
            86400 )

@       NS  ns1.test.mydomain.com.

ns1 IN A    10.225.0.51
www IN A    10.225.0.171
db  IN A    10.225.0.171
ftp IN A    10.225.0.171

Best Answer

Add another zone entry, similar to the existing one in the named.conf file, with the DNS name and file name of your second domain.