Bind is a DNS service that can be installed on most Linux distributions and its high popularity is for both high performance and being free. BIND, like other DNS servers, has a standardized and integrated architecture, and has the ability to add multiple domains. In this tutorial we will learn how to Install Bind on CentOS 7.
Install Bind on CentOS 7
Update your CentOS using the below command:
yum update –y
Reboot your server after updating CentOS:
reboot
Now, Install bind and its tools using below command:
yum install bind bind-utils –y
We must configure our DNS server after it is installed. Open named.conf file using a text editor like nano or Vi. The main config file for BIND is called named.conf:
nano /etc/named.conf
Remove all its lines and replace the following lines inside it:
options {
#listen-on port 53 { 127.0.0.1; 192.168.10.100 };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
allow-transfer { localhost; };
recursion no;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
We have configured main options in this file. We will explain you some important parts of this file to make you familiar with these options.
Listen on: listen-on defines the port and IP address(es) on which BIND will listen for incoming queries. The default is port 53 on all server interfaces. Enter Multiple listen-on statements are allowed. This statement may only be used in a global options clause. Enter your server local and IP address for this option. Allow transfer: defines a match list e.g. IP address(es) that are allowed to transfer (copy) the zone information from the server (master or slave for the zone). If you decide to configure a secondary DNS server, you must mention its IP here.
Recursion: This option protects you from DDOS attacks on DNS server and you must set it as NO.
After configuring BIND basic options, we will continue the tutorial with Zone configuration.
Zone configuration in BIND
In order to create a Zone, append these lines to the end of named.conf file:
zone "1gbits.com" IN {
type master;
file "azarlearn.com.zone";
allow-update { none; };
};
Note: Enter your domain name instead of 1gbits.com.
Note: We have created a file with .zone extension you must edit it to configure records and etc. After adding zone to named.conf file, you do not need to work with this file again. Save and exit it. Now to configure zones and its records, open the file that you have defined it in previous step:
nano –w /car/named/azarlearn.com.zone
Then copy these lines to it:
$TTL 86400
@ IN SOA ns1.azarlearn.com. root.azarlearn.com. (
2013042201 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
; add nameservers
IN NS ns1.azarlearn.com.
; Resolve nameserver hostnames to IP
ns1 IN A 192.168.10.100
In first seven lines of above file, we have configured Refresh Time, TTL, etc.
We have defined a NS record too.To define other records in BIND, you must enter record name and address like our final line. For example, we created an A record and point it to client using the following line:
Client1 IN A 192.168.10.101
This A record point to client1 with 192.168.10.101 IP address. To apply configurations, restart BIND service using below command:
systemctl restart named
To add BIND to startup services, use bellow comman:
systemctl enable named
Conguratulations! You have installed BIND on CentOS 7 and configured Zone. If you need a web based envirement to control BIND, you can use Webmin control panel.
If you are facing any problem with the installation, feel free to comment here. We will help you to solve the issue.
free iptv
2018 Oct 06, 03:10:13
Hello,nice share.
Tera
2019 Mar 07, 03:03:26
Hurrah, that's what I was seeking for, what a stuff! existing here at this weblog, thanks admin of this site.