Tuesday, December 27, 2011

BIND (DNS Server) sample configuration

The below is sample DNS configuration for example.com domain. This includes
a) MX record for example.com domain
b) Single hostname resolving to multiple IPs (used for SCAN IPs in Oracle grid infrastructure 11gR2)
c) Subdomain delegation (used for GNS configuration in Oracle grid infrastructure 11gR2)
d) Auto generation of records (to generate systematic names)

/etc/named.conf
 
options {
        directory "/var/named";
        // forward only;
        forwarders { 10.0.0.1; };
};

zone "example.com." IN {
        type master;
        file "example.com.db";
};

zone "0.168.192.in-addr.arpa." IN {
        type master;
        file "192.168.0.db";
};

  

/var/named/example.com.db
 ; Start of Authority record
@                               SOA     ns   nsadmin@example.com.   (
                                                        11    ; serial
                                                        3H    ; refresh
                                                        1H    ; retry
                                                        1W    ; expiry
                                                        1H    ; minimum
                                                )

; Name server record of this zone
                                NS      ns

; MX Record for mail server
                                MX      10 mail

; Address record for name server itself
ns                              A       192.168.0.1

; Other address records
server5                         A       192.168.0.5
; Address record with FQDN name
server6.example.com.            A       192.168.0.6

; CNAMEs
mail                            CNAME   server5.example.com.
www                             CNAME   server6

; Single hostname resolving to multiple IPs
; IP addresses will be given as answers in Round Rabin fashion
cluster1-scan                   A       192.168.0.51
                                A       192.168.0.52
                                A       192.168.0.53

; Deligating to subdomain grid.example.com
; gns.grid.example.com is name server for grid.example.com domain
grid                            NS      gns.grid
; Glue record for delegation
gns.grid                        A       192.168.0.65

; Auto generation of records
$GENERATE 11-20 server$         A       192.168.0.$

 
 /var/named/192.168.0.db
 ; Start of Authority record
@                       SOA     ns.example.com. nsadmin@example.com. (
                                                           4     ; serial
                                                           3H    ; refresh
                                                           1H    ; retry
                                                           1W    ; expiry
                                                           1H    ; minimum
                                                   )
; Name server record of this zone
                        NS      ns.example.com.

; Pointer record of name server
1                       PTR     ns.example.com.

; Other PTR records
5                       PTR     server5.example.com.
6                       PTR     server6.example.com.

51                      PTR     cluster1-scan.example.com.
52                      PTR     cluster1-scan.example.com.
53                      PTR     cluster1-scan.example.com.

; Auto generation of records
$GENERATE 11-20 $       PTR     server$.example.com.


No comments:

Post a Comment