We will be setting up Primary and Slave DNS Servers

Primary Server

Install Packages:

$ yum install bind bind-utils -y
```<p>



**BIND Configuration:**

Edit `/etc/named.conf`

```language-bash
options {

# Zone File Directories
directory "/var/named";

# Forwarders
forwarders { 8.8.8.8; };
};

# Forwarad Zones
zone "example.com" IN {
        type master;
        file "example.com.zone"; 
        allow-update { none; };
};

# Reverse Zones
zone "1.16.172.in-addr.arpa" IN {
        type master;
        file "1.16.172.in-addr.arpa.zone";  
        allow-update { none; };
};

```<p>

**Zone Configuration:**

Create your zone file `/var/named/example.com.zone:`

```language-bash
$ORIGIN .
$TTL 600        ; 10 minutes
example.com.    IN SOA  ns1.sysadmins.co.za. dex.example.com. (

                        2016050301 ; serial
                        600        ; refresh (10 minutes)
                        300        ; retry (5 minutes)
                        432000     ; expire (5 days)
                        600        ; minimum (10 minutes)
                        )

                        NS      mail.sysadmins.co.za.
                        MX      10 mail.example.com.

$ORIGIN example.com.

                IN      A       172.16.1.3
mail            IN      A       172.16.1.1
www             IN      A       172.16.1.2
ns1             IN      A       172.16.1.3
new             IN      A       172.16.1.3
ftp             IN      CNAME   www.example.com.

```<p>

**PTR Configuration:**

Create your zone file for your reverse lookups `/var/named/1.16.172.in-addr.arpa.zone`

```language-bash
$TTL 3600
@       IN SOA  ns1.sysadmins.co.za. dex.example.com. (
                                        2014042501       ; serial
                                        3600             ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
                IN      NS      ns1.sysadmins.co.za.
1               IN      PTR     mail.example.com.
2               IN      PTR     www.example.com.

```<p>

Update permissions:

```language-bash
$ chgrp named /var/named/*
```<p>

> ### Slave Server

**Install Packages:**

```language-bash
$ yum install bind bind-utils -y
```<p>

**BIND Configuration:**

Edit `/etc/named.conf:`

```language-bash
options {
        directory "/var/named";
        forwarders {8.8.8.8; };

};

zone "example.com" IN {
        type slave;  ## NS2 role is defined ##
        file "example.com-sl"; ## the zone file will be automatically created 
        allow-transfer {172.16.1.3; };  ## Primary 
        masters {172.16.1.3; }; ## Primary
};

zone "1.16.172.in-addr.arpa" IN {
        type slave; 
        file "sl-172-16-1"; ## the zone file will be automatically created ##
        allow-transfer {172.16.1.3; }; 
        masters {172.16.1.3; };
};

```<p>


**Finishing Up:**

```language-bash
$ chmod 770 /var/named/
$ service named restart
$ rndc retransfer example.com
```<p>