Adding a second domain name with Bind9

May 23, 2014 4.8k views
Hello! I'm fairly new to all of this and have been following lots of guides. The guide I followed for this was http://www.servermom.org/how-to-install-and-setup-bind9-on-ubuntu-server/136/ . Basically I successfully set up my first domain (domain1) so it points to ns1.domain1.com and ns2.domain1.com and works perfect. When I went to set up my second domain (domain2) I added it to my /etc/bind/named.conf.local file with this code: zone "domain2.com" { type master; file "/etc/bind/zones/domain2.com.db"; }; Then I went to edit the db file which is this code: zone "wakeupontop.com" { type master; file "/etc/bind/zones/wakeupontop.com.db"; }; ; BIND data file for domain.com ; $TTL 14400 @ IN SOA ns1.domain.com. host.domain.com. ( 201006601 ; Serial 7200 ; Refresh 120 ; Retry 2419200 ; Expire 604800) ; Default TTL ; domain.com. IN NS ns1.domain.com. domain.com. IN NS ns2.domain.com. domain.com. IN MX 10 mail.domain.com. domain.com. IN A xxx.xxx.xxx.xxx ns1 IN A xxx.xxx.xxx.xxx ns2 IN A xxx.xxx.xxx.xxx www IN CNAME domain.com. mail IN A xxx.xxx.xxx.xxx ftp IN CNAME domain.com. domain.com. IN TXT "v=spf1 ip4:xxx.xxx.xxx.xxx a mx ~all" mail IN TXT "v=spf1 a -all" My question is.. How do I edit the DB file. Where do I put domain2 and domain1? I really appreciate the help! Matt
2 Answers
zone "wakeupontop.com" {
type master;
file "/etc/bind/zones/wakeupontop.com.db";
};

that is not in the DB code.. I accidentally put that on my post :\ cant figure out how to take it off.
Check your /etc/bind/named.conf.local file and in the zones section make it look like this.
zone "domain1.com" { 

type master;
file "/etc/bind/zones/domain1.com.db";
};

zone "domain2.com" {
type master;
file "/etc/bind/zones/domain2.com.db";
};


Now go to /etc/bind/zones and create the find domain2.com.db and add the following. ns1 and ns2 are from domain1.
; BIND data file for domain2.com

;
$TTL 14400
@ IN SOA ns1.domain1.com. host.domain1.com. (
201006601 ; Serial
7200 ; Refresh
120 ; Retry
2419200 ; Expire
604800) ; Default TTL
;
domain2.com. IN NS ns1.domain1.com.
domain2.com. IN NS ns2.domain1.com.

domain2.com. IN MX 10 mail.domain2.com.
domain2.com. IN A xxx.xxx.xxx.xxx

ns1 IN A xxx.xxx.xxx.xxx
ns2 IN A xxx.xxx.xxx.xxx
www IN CNAME domain2.com.
mail IN A xxx.xxx.xxx.xxx
ftp IN CNAME domain2.com.
domain.com. IN TXT "v=spf1 ip4:xxx.xxx.xxx.xxx a mx ~all"
mail IN TXT "v=spf1 a -all"
Have another answer? Share your knowledge.