DNS server is used to resolve domain name into IP address. There are three common DNS server configurations can be done using BIND, caching nameserver, primary master and secondary master more info.
Here in this post we can see about how to install and configure DNS server in ubuntu 14.04.
Step 1 » Update the repositories. sudo apt-get update
Step 2 » Install bind9 using the below command.sudo apt-get install bind9
Now installation is over, please proceed with configuration.
Caching nameserver will remember all the DNS queries made and serves locally when the domain is queried second time. Default configuration will act as a caching nameserver, you just need is to add public DNS IPs in the configuration file.
Step 3 » Open /etc/bind/named.conf.options file and find forwarders column , uncomment and edit like the following.
forwarders { 8.8.8.8; 8.8.4.4; };
Here 8.8.8.8 and 8.8.4.4 are google public DNS servers .
Step 4 » Now start/restart the service.sudo service bind9 restart
Step 5 » Now test using dig command . open /etc/resolv.conf and edit nameserver ip to 127.0.0.1 or your serverIP.nameserver 127.0.0.1
Now type the below command to see results.krizna@ns:~$ dig www.krizna.com
It took 83 msec for the first time . Now try the same command again.
................
;; Query time: 83 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
.................krizna@ns:~$ dig www.krizna.com
Now reduced to 5 msec . This time it serves from local.
................
;; Query time: 5 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
.................
Primary master configuration is just like managing DNS records for particular domain locally ( Eg: krizna.com ).
Scenario details:
Domain name : krizna.com
Server ip : 192.168.6.5
Server hostname : ns.krizna.com
Webserver ip : 192.168.6.10 ( www.krizna.com) .
We need to create 2 zone files , Forward zone and reverse zone.
Step 6 » Create forward zone file db.krizna.com by copying db.local conf file.sudo cp /etc/bind/db.local /etc/bind/db.krizna.com
Step 7 » Now open /etc/bind/db.krizna.com and edit like below.
; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA ns.krizna.com. root.ns.krizna.com. ( 2 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS ns.krizna.com. @ IN A 192.168.6.5 @ IN AAAA ::1 ns IN A 192.168.6.5 www IN A 192.168.6.10
Step 7 » Create reverse zone file db.192 by copying db.172 conf file.sudo cp /etc/bind/db.127 /etc/bind/db.192
Step 8 » Now open /etc/bind/db.192 file and edit like below.
; BIND reverse data file for local loopback interface ; $TTL 604800 @ IN SOA ns.krizna.com. root.ns.krizna.com. ( 1 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS ns. 5 IN PTR ns.krizna.com. 10 IN PTR www.krizna.com.
Step 9 » Now open /etc/bind/named.conf.local configuration file and add the below lines to include forward and reverse zone files . 6.168.192 in reverse column is just first three octets of your network.
// Forward zone zone "krizna.com" { type master; file "/etc/bind/db.krizna.com"; }; //reverse zone zone "6.168.192.in-addr.arpa" { type master; file "/etc/bind/db.192"; };
Step 10 » Now restart the service.sudo service bind9 restart
Step 11 » Now test using nslookup or dig commands.krizna@ns:~$ nslookup www.krizna.com
Now test reverse lookup
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: www.krizna.com
Address: 192.168.6.10krizna@ns:~$ nslookup 172.27.6.10
That’s it , Your DNS server is ready .
Server: 127.0.0.1
Address: 127.0.0.1#53
10.6.27.172.in-addr.arpa name = www.krizna.com.
Visual Studio Code is a popular code editor which is lightweight and cross platform application.…
MySQL workbench is a GUI tool for managing MySQL database system. It is used by…
Android Studio is a popular development software used especially for developing android applications. It is…
Google chrome is a most popular web browser developed by google. It was developed to…
Zoom is a popular video conferencing software. It is commonly used for conducting online meetings,…
TeamViewer is a popular application for desktop sharing and remote control. It is available for…