Wednesday, June 17, 2015

Configuring Bind for serving as nameserver for multiple domains



I have installed bind9 on a Debian VPS, and use it as nameserver for one of my domains. It works well. dig reports correct entries.




I now wish to use this nameserver for four more domains, and am a bit confused about certain configuration parameters.



The primary domain I used is drjoel.in, for which I have set up the following in master zone file



cat /etc/bind/named.conf.local
zone "drjoel.in" {
type master;
file "/var/lib/bind/db.drjoel.in";
allow-update { key rndc-key; };

};
zone "31.167.199.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.14.31.167.199.in-addr.arpa";
};


I have added this:



zone "relsoft.in" {

type master;
file "/var/lib/bind/db.relsoft.in";
allow-update { key rndc-key; };
};


for my second domain, and the following in /var/lib/bind/db.relsoft.in:



relsoft.in.       IN      SOA     ns1.joel.co.in. admin.relsoft.in. (
2007010401 ; Serial

3600 ; Refresh [1h]
600 ; Retry [10m]
86400 ; Expire [1d]
600 ) ; Negative Cache TTL [1h]
;
relsoft.in. IN NS ns1.joel.co.in.
relsoft.in. IN NS ns2.joel.co.in.
relsoft.in. IN MX 10 aspmx.l.google.com.
relsoft.in. IN A 198.23.228.223
www. IN A 198.23.228.223

ns1. IN A 199.167.31.14
ns2. IN A 38.114.103.106
mail.relsoft.in. 3600 IN CNAME ghs.google.com
*.relsoft.in. 3600 IN CNAME relsoft.in.


My /etc/resolv.conf currently looks like this:



#cat /etc/resolv.conf
search drjoel.in

nameserver 199.167.31.14


My questions are:




  1. What should my resolv.conf be, to allow me to use this server as nameserver for both domains?

  2. Am I correct in assuming that I shouldnt add a reverse DNS (PTR) for the second domain, since I already have one for the first domain?

  3. Other than editing /etc/bind/named.conf.local and adding /var/lib/bind/db.relsoft.in, are there any additional steps to do?



Answer




  1. resolv.conf has nothing to do with using the nameserver for a domain. (resolv.conf contains a list of caching nameservers for the server/host, and not a list of authoritative nameservers for the domains hosted on the server .

  2. For the domains to work, you don't need reverse DNS. Also probably you can't set that (ie rDNS's won't be visible on internet). This is because in most of the cases is set by your server/IP provider .
    3.This doesn't look ok:
    relsoft.in. IN NS ns1.joel.co.in.
    relsoft.in. IN NS ns2.joel.co.in.
    The nameservers shouldn't be ns1.drjoel.in and ns2.drjoel.in ? As i see joel.co.in is not registered.
    Well, just checked, and the nameservers are ns1.relsoft.in and ns2.relsoft.in . So i would change the NS records to that.
    relsoft.in. IN NS ns1.relsoft.in.

    relsoft.in. IN NS ns2.relsoft.in.
    Also change the SOA record to
    relsoft.in. IN SOA ns1.relsoft.in. admin.relsoft.in. ( etc


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...