0

I have successfully setup DNS server on Centos7. But, configured only one nameserver 'NS1' and want to configure one more nameserver 'NS2' for the same IP.

Have done the below changes in forward and reversed zone.

 ##########Forward zone############
    $TTL 1D
@       IN SOA  ns1.mydomain.in. root.ns1.mydomain.in. (
                                        01      ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        IN      NS      ns1.mydomain.in.
ns1     IN      A       10.20.10.20
ns2     IN      A       10.20.10.20


        ############## Reversed Zone ###################
        $TTL 1D
        @       IN SOA  ns1.mydomain.in. root.ns1.mydomain.in. (
                                                3       ; serial
                                                1D      ; refresh
                                                1H      ; retry
                                                1W      ; expire
                                                3H )    ; minimum
                IN      NS      ns1.mydomain.in.
        20      IN      PTR     ns1.mydomain.in.
        20      IN      PTR     ns2.mydomain.in.

Are these changes sufficient or do I need to make any more modifications?

1 Answers1

0

If you have a nameserver running on one IP address you cannot run another on the same IP address. They both want to use the same UDP port, which is only available for one service (=program) on that IP address. This means you cannot route them to one or the other node inside a cluster specifically.

You can also not identify which DNS server name it was sent to as you might assume from HTTP. DNS carries only the question: "Hey 10.20.10.20, which IP belongs to example.mydomain.in?" - you might notice that it uses the IP to ask the server, not its name.

The most common setup with two DNS servers is the primary + secondary (master/slave) server setup. This consists of two servers each with his own IP and own PTR Record.

On another site they gave some information about multiple PTR records to the same ip and why to avoid them: Why multiple PTR records in DNS is not recommended?

If you intend to build the two server setup, you'd have 2 NS lines and 2 A lines as well as 2 PTR lines. Assuming they have 21 and 22 for node-specific IPs and share the 20 for external representation of other services provided on this cluster.

@ IN NS ns1.mydomain.in.
@ IN NS ns2.mydomain.in.
ns1 IN A 10.20.10.21
ns2 IN A 10.20.10.22

The PTR would be also separate for each server:

@ IN NS ns1.mydomain.in.
@ IN NS ns2.mydomain.in.
21 IN PTR ns1.mydomain.in.
22 IN PTR ns2.mydomain.in

Clustering DNS servers doesn't make much sense as the UDP requests are handled fast enough through regular DNS requests and DNS clients allow more than one resolver. Also there is a way called zone transfer (with notify) to make two servers communicate with each other to keep the records identical.

One configuration example for bind: http://www.microhowto.info/howto/configure_bind_as_a_slave_dns_server.html

If you are still keen on having them clustered, then you can remove ns2 from the entries and just represent the server as ns1.mydomain.in. They still have to internally synchronize the records through the zone transfer and notify system or some more complex scripts though.