Install And Configure BIND DNS Server

[Total: 8    Average: 5/5]

Install And Configure BIND DNS Server

BIND is open source software that implements the Domain Name System (DNS) protocols for the Internet which provides ability to perform name to ip conversion. BIND is the most common program used for maintaining a name server on Linux. And today we will Install And Configure BIND DNS Server on cantos server

Update Server OS

Login your server with SSH and Then run the command below to update your CentOS server with latest updates and security updates.

yum update

Install Bind

BIND package can directly be installed using the ‘yum’ command through its built in repositories by running the below command

yum install bind bind-utils.

Start Bind Service.

Once your BIND packages are installed, you need to start its service and enable it to start automatically after every reboot

chkconfig named on

/etc/init.d/named restart

/etc/init.d/named status

You can check bind verison with below command.

/usr/sbin/named -v

Bind Configuration.

Bind confiration file is /etc/named.conf, Open /etc/named.conf file and  comment out the following lines to enable BIND and listen on all ip address’s instead of only localost

nano /etc/named.conf
 #listen-on port 53 { 127.0.0.1; };
 #listen-on-v6 port 53 { ::1; };

Then add your network in the file that will allow the clients from your mentioned network to query the DNS for name to ip translation

allow-query { localhost;162.27.10.0/24; };

Create Bind zone.

nano  /etc/named.conf

zone "yourdomain.com" IN {
 type master;
 file "/var/named/yourdomain.com.zone";
 allow-update { none; };
 };

zone "0.168.192.in-addr.arpa" IN {
 type master;
 file "/var/named/0.168.192.rev";
 allow-update { none; };
 };

Create BIND Zone Files

nano /var/named/yourdomain.com.zone

$TTL            86400
 @                 IN SOA            yourdomain.com.  root.yourdomain.com. (
 100     ; serial
 1H      ; refresh
 1M      ; retry
 1W      ; expiry
 1D )    ; minimum
 @                    IN NS             ns1.yourdomain.com.
 @                    IN A                 192.168.0.1
 ns1                 IN A                 192.168.0.1
 @                    IN MX   10      mail.yourdomain.com.
 mail                IN A                 192.168.0.1
 WWW               IN A                 192.168.0.1

 

Create /var/named/0.168.192.rev file with the following code

nano /var/named/0.168.192.rev

$TTL    86400
 @                 IN SOA          yourdomain.com. root.yourdomain.com. (
 100     ; serial
 1H      ; refresh
 1M      ; retry
 1W      ; expiry
 1D)     ; minimum
 @                IN NS            ns1.yourdomain.com.
 1                 IN PTR          binggo.yourdomain.com.

Since the zone file has been created you can now check if everything is working by restarting named service:

/etc/init.d/named restart

chkconfig named on

If there is any error then check /var/log/messages file and contact us through live chat OR ticket system.