We use cookies to improve our services and provide a better experience. By continuing to use this site, you agree with our Cookies Policy.

Tutorials

More than 400 step-by-step articles to guide you through online project development.
HomeTutorialsOperating SystemsLinuxAdministration

How to install bind DNS server on CentOS 6?

Brazil VPS

How to install bind DNS server on CentOS 6?

In this tutorial you will learn how to set up and configure BIND DNS server on your CentOS 6 operating system. BIND is alternative software for translating IP addresses to domain names. It was designed for the convenience of users because alphabetic names are easier to remember than numerical IP addresses.

You have to register your private nameservers if you want to use your own nameservers; it can be done from your current domain registrar client area (if supported). You can find a tutorial on this topic here: https://support.host1plus.com/index.php?/Knowledgebase/Article/View/1254/0/how-to-register-private-nameservers.

Before the installation of BIND you need to make sure that your operating system is updated. It can be done by checking for updates using yum command:

yum –y update

Now begin with the installation procedures of BIND and BIND utils on your CentOS 6 operating system:

yum install bind bind-utils -y

Next, add your domain zone in BIND configuration file, below existing zones:

nano /etc/named.conf

(nano text editor is not included in CentOS 6 installation by default, you need to install it using yum command: yum -y install nano)

zone “host1plus.com” IN {
type master;
file “host1plus.com.zone”;
allow-update { none; };
};

Click Ctrl+X, type “y” letter and click enter to save changes. Now you are ready to create a zone file for your domain. Tthe zone file must be located in /var/named directory:

nano /var/named/host1plus.com.zone

Also, add the following code to your newly created zone file, where X.X.X.X is your IP address:

$TTL 86400
@ IN SOA ns1.host1plus.com. root.host1plus.com. (
2013042201 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
; Specify your nameservers
IN NS ns1.YOURNAMESERVER.com.
IN NS ns2.YOURNAMESERVER.com.
; Specify A records (IP addresses) of your nameservers.
ns1 IN A X.X.X.X
ns2 IN A X.X.X.X; Define hostname -> IP pairs which you wish to resolve
@ IN A X.X.X.X
www IN A X.X.X.X
; Define MX record, and hostname for mail, ftp service
@                    IN MX   10      mail.YOURDOMAIN.com.
mail                IN A              X.X.X.X
ftp IN CNAME YOURDOMAIN.com.

(Hint: you may point your nameservers and A record to different IP addresses)

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

/etc/init.d/named restart

Also, you need to make sure that named service starts on boot of the server:

chkconfig named on

Now you may want to check your domain’s DNS zone. It can be done by digging your domain from command line:

dig ns host1plus.com

Output should be:

; <<>>DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.2 <<>> ns host1plus.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER< ;; flags: qrrdra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;host1plus.com. IN NS;; ANSWER SECTION:
host1plus.com. 14399 IN NS ns2.host1plus.com.
host1plus.com. 14399 IN NS ns1.host1plus.com.;; Query time: 146 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue Aug 18 05:58:43 2015
;; MSG SIZE rcvd: 67

Also we can check A record of your newly added domain by running the following command:

dig host1plus.com

Output:

; <<>>DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.2 <<>> host1plus.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER< ;; flags: qrrdra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;host1plus.com. IN A;; ANSWER SECTION:
host1plus.com. 14399 IN A 5.231.195.166;; Query time: 134 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue Aug 18 05:59:55 2015
;; MSG SIZE rcvd: 47

That’s it, now you just have to change the nameservers of your domain to the ones newly created and wait for up to 24 hours for worldwide DNS propagation.

Windows Cloud Server
Rate this Tutorial:
No Comments

Other (3)

Popular Keywords