How do I use BIND DNS with multiple domain names?
Solution 1
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.
Solution 2
When you create another zone in Bind, you add another section to named.conf and point it to another data file (db.test.myotherdomain.com).
Related videos on Youtube
NightOwl888
Updated on September 18, 2022Comments
-
NightOwl888 almost 2 years
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:
- test.mydomain.com
- www.test.mydomain.com
- www2.test.mydomain.com
I need to also make the server resolve:
- test.myotherdomain.com
- www.test.myotherdomain.com
- 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
-
NightOwl888 about 13 yearsActually, it is the fact that I need to run multiple virtual machines that eats up the RAM, not because I am running BIND. I am using bind because Windows XP Pro doesn't include DNS.
-
Ward - Reinstate Monica about 13 yearsAnd since SF is for professional admins, your question is likely to be closed as off topic.
-
NightOwl888 about 13 yearsWhy would you automatically assume I am not being paid for this (I am) just because I know nothing about setting up BIND? It just so happens I am a developer full-time and an admin part-time.