Linux – Own DNS server (bind9)

The second most important service for internet use is DNS server.

In my opinion www server (Apache/NginX) is most important part but DNS is just after it ;-). DNS service use very useful when we are managing your own domain.

Here is the simplest setup for own service:

apt-get install bind9
#config file
vim /etc/bind/named.conf.local
### named.conf.local ###
acl slaves {
        ip.adres.secondary.dns;
};

zone "example.com" {
        type master;
        file "/etc/bind/zones/db.example.com";
        allow-transfer { slaves; };
};
### end named.conf.local ###
# this setup allow you to use your server as master-slave setup

vim /etc/bind/zones/db.example.com
### db.example.com ###
; example.com
$TTL    604800
@       IN      SOA     ns1.example.com. root.example.com. (
                     2006020201 ; Serial
                         604800 ; Refresh
                          86400 ; Retry
                        2419200 ; Expire
                         604800); Negative Cache TTL
;
@       IN      NS      ns1
        IN      MX      10 mail
        IN      A       192.0.2.1
ns1     IN      A       192.0.2.1
mail    IN      A       192.0.2.128
www     IN      A       192.0.2.1
client1 IN      A       192.0.2.201
### end db.example.com ###

Everytime we add ‘zone’ file we need to restart server:

service bind9 restart

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*