Create 2 DNS names for 2 domains on one static IP – Ubuntu

I have VPS Ubuntu 15.04 and there I have configured DNS for one of my external domains.

This is sample of configuration at ‘/etc/bind/named.conf.local’:

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

and inside ‘/etc/bind/zones/test.com.db’

$TTL 600
test.com.      IN      SOA     ns1.test.com. admin.test.com. (
                                                        2006081401
                                                        28800
                                                        3600
                                                        604800
                                                        38400
)

test.com.      IN      NS              ns1.test.com.
test.com.      IN      NS              ns2.test.com.

test.com.      IN      MX     10       mta.test.com.

test.com.       IN      A       111.111.111.111
*                       IN      A       111.111.111.111

ns1.test.com.              IN      A       111.111.111.111
ns2.test.com.              IN      A       111.111.111.111

www              IN      A       111.111.111.111
mta        

Now if I want to use one more domain sample ‘test.info’ what do I need to do here?

Maybe create new zone and zone file like??:

zone "test.info" {
        type master;
        file "/etc/bind/zones/test.info.db";
        }; 

and zones/test.info.db like ??

$TTL 600
test.info.      IN      SOA     ns1.test.info. admin.test.info. (
                                                        2006081401
                                                        28800
                                                        3600
                                                        604800
                                                        38400
)

test.info.      IN      NS              ns1.test.info.
test.info.      IN      NS              ns2.test.info.

test.info.      IN      MX     10       mta.test.info.

test.info.       IN      A       111.111.111.111
*                       IN      A       111.111.111.111

ns1.test.info.              IN      A       111.111.111.111
ns2.test.info.              IN      A       111.111.111.111

www              IN      A       111.111.111.111
mta  

Or I just need to create new zone record like:

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

and point it to first domain ‘test.com.db’ file ?

Answer

Normally you would have a separate file for each zone but if you specifically want to ensure you have the exact same set of records in multiple zones it is, under certain conditions, possible to have multiple zones backed from the same file.

  • The zone files must only be accessed in a read-only fashion by named (no dynamically updated zones, no slave zones, etc).
  • The zone files must only contain records with relative owner names (eg @ over example.com., foo over foo.example.com. etc).
  • The zones really have the exact same (zone-relative) set of records.

In short, if you want to keep things simple, just do the normal thing and create separate files. Then you don’t have any special constraints to worry over.

Attribution
Source : Link , Question Author : Nezir , Answer Author : Håkan Lindqvist

Leave a Comment