10 Easy Steps to setup BIND DNS Server on CentOS 6
10 Easy Steps to setup BIND DNS Server on CentOS 6
BIND (Berkely Internet Name Domain) is a popular software for translating domain names into IP addresses and usually found on Linux servers. This article will explain the basic concepts of DNS BIND and analyse the associated files required to successfully setup your own DNS BIND server.
DNS or Domain Name System, as we know is an internet service that is used to translate the user friendly domain into computer friendly IP addresses. Not only can we translate domain names to IP addresses, we can also perform reverse translation i.e. from IP addresses to a domain name translations.
Step 1: With the new server, it’s always proud to ensure your system is up to date. You can verify this by checking for updates using yum as follows.
#yum update -y
Step 2 : After completing the update, Now we need to install the BIND and BIND Utilities packages first by using yum.
#yum install bind bind-utils -y
Step 3 : After installing Bind, we have to open the BIND (named) configuration file to make several changes on it.
#nano -w /etc/named.conf
If “nano”editor is not installed, you can use “vi” editor, or use below command to install nano editor
#yum install nano
Step 4 : Modify your named.conf file as follows, replacing 12.12.12.12 with the IP of your VPS.
options { #listen-on port 53 { 127.0.0.1; }; 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; 12.12.12.12; }; 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"; };
Note : listen-on must be commented to listen on all available interfaces.
Recursion should be turned off to prevent your server from being abused in “reflection” DDoS.
Step 5 : Next,we need to add a new zone for our first domain, you should add the following to your named.conf file below the existing zones.
zone "your_domain.com" IN { type master; file "your_domain.com.zone"; allow-update { none; }; };
Now, Save this named.conf file with above changes and we are ready to create our first zone file.
Configure BIND Zones
Step 6 : Open the zone file, using the name you specified in the configuration above.
#nano -w /var/named/your_domain.com.zone
Step 7 : Add the following contents to our newly created file.
You should replace 11.11.11.11, 22.22.22.22 and 33.33.33.33 with your relevant IP address.
$TTL 86400$TTL 86400 @ IN SOA ns1.mydomain.com. root.mydomain.com. ( 2013042201 ;Serial 3600 ;Refresh 1800 ;Retry 604800 ;Expire 86400 ;Minimum TTL ) ; Specify our two nameservers IN NS ns1.mydomain.com. IN NS ns2.mydomain.com. ; Resolve nameserver hostnames to IP, replace with your two droplet IP addresses. ns1 IN A 11.11.11.11 ns2 IN A 22.22.22.22 ; Define hostname -> IP pairs which you wish to resolve @ IN A 33.33.33.33 www IN A 33.33.33.33
Step 8 : Now start named for the first time. This may take several minutes while named generates the rndc.key file, which only occurs on first execution.
#service named restart
Step 9 : Once named has started successfully, We need to enable it as a startup service, by running
#chkconfig named on
Step 10 : By now, we should have a fully operational primary name server. You can verify that BIND is working correctly by running the following command, by replacing 11.11.11.11 your_domain.com, with your ip address and domain name.
#dig @11.11.11.11 your_domain.com
If you receive a response which includes an answer and authority section, your name server has been configured correctly.
Hope this article, helps your need. Kindly share your comments to improve us.
To know about restoring SQL file through PHPMyadmin : Click Here