Phone :  +370 (5) 204-1903
Email: sales@1gbits.com

How To install BIND on Ubuntu 16

Type this command then hit enter:

Ubnutu Tutorials Sep 10, 16 by admin 6 min Read
How To install BIND on Ubuntu 16

BIND (Berkely Internet Name Domain) is a popular software for translating domain names into IP addresses and usually found on Linux VPS & Linux Dedicated Server. This article will explain the basic concepts of DNS BIND and analyse the associated files required to successfully setup your own DNS BIND server. After reading this article, you will be able to successfully install and setup a Linux BIND DNS server for your network.


 apt-get install bind9
Once done you’ll see a message saying:
 * Starting domain name service... bind9      [OK]



So you have installed BIND9 on your server. It is time to show you a basic configuration how to setup your domain to resolve to your server. Here’s what I did. Type following command then hit Enter on your keyboard:
nano /etc/bind/named.conf.local
Nano editor screen will appear. Copy-paste command below into your favorite text editor like Notepad, Notepad2 or Notepad++:
zone "domain.com" {
type master;
file "/etc/bind/zones/domain.com.db";
zone "3.2.1.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.3.2.1.in-addr.arpa";
Again, in any command in this page you’ll need to replace “domain.com” with your own domain name and corresponding TLD. E.g: 1gbits.com. Also, you have to replace xxx.xxx.xxx.xxx with IP address of your server. Once you’ve done editing necessary values, you can paste it to Nano editor screen. You can also simply type command syntax above to Nano editor screen while replacing necessary value during your typing. Now hit Control+O on your keyboard to save the file then hit Control+X to exit Nano editor. Then go to bind directory to make things easier. Type this command:
cd /etc/bind
Create new directory called “zones” inside it.. Use this command:
mkdir zones
Now go enter that directory as well..
cd zones
Then create new file called “nano domain.com.db“. Type this command:
nano domain.com.db
of course at this part you’ll also need to replace “domain.com” with your own domain name. Example:
nano 1gbits.com.db
That command brings Nano editor screen up once again. Next, you can either copy these syntax to Notepad first then edit it or simply type it in Nano editor directly:
; BIND data file for domain.com
$TTL 14400
@ IN SOA ns1.domain.com. host.domain.com. (
201006601 ; Serial
7200 ; Refresh
120 ; Retry
2419200 ; Expire
604800) ; Default TTL
domain.com. IN NS ns1.domain.com.
domain.com. IN NS ns2.domain.com.
domain.com. IN MX 10 mail.domain.com.
domain.com. IN A xxx.xxx.xxx.xxx
ns1 IN A xxx.xxx.xxx.xxx
ns2 IN A xxx.xxx.xxx.xxx
www IN CNAME domain.com.
mail IN A xxx.xxx.xxx.xxx
ftp IN CNAME domain.com.
domain.com. IN TXT "v=spf1 ip4:xxx.xxx.xxx.xxx a mx ~all"
mail IN TXT "v=spf1 a -all"
Here’s an example of mine:
; BIND data file for 1gbits.com
$TTL 14400
@ IN SOA ns1.1gbits.com. host.1gbits.com. (
201006601 ; Serial
7200 ; Refresh
120 ; Retry
2419200 ; Expire
604800) ; Default TTL
1gbits.com. IN NS ns1.1gbits.com.
1gbits.com. IN NS ns2.1gbits.com.
1gbits.com. IN MX 10 mail.1gbits.com.
1gbits.com. IN A
ns1 IN A
ns2 IN A
www IN CNAME 1gbits.com.
mail IN A
ftp IN CNAME 1gbits.com.
1gbits.com. IN TXT "v=spf1 ip4: a mx ~all"
mail IN TXT "v=spf1 a -all"
If you have two IPs, you can replace “ns2 IN A xxx.xxx.xxx.xxx” with your second IP address. Otherwise simply use the same IP. Once done editing, hit Control+O to save that file then hit Control+X to exit Nano editor. Next step, it’s time to define reverse DNS lookup. Sounds not so familiar? Don’t worry simply repeat my steps. Type this command syntax:
nano /etc/bind/zones/rev.3.2.1.in-addr.arpa
That will open Nano editor screen again but this time you will edit another file. Add following lines inside that file..
@ IN SOA domain.com. host.domain.com. (
86400 );
IN NS ns1.domain.com.
4 IN PTR domain.com.
Replace “host.domain.com” with your own server’s host name. Once done, press Control+O to save followed by Control+X to exit. Example:
@ IN SOA 1gbits.com. host.1gbits.com. (
86400 );
IN NS ns1.1gbits.com.
4 IN PTR 1gbits.com.
That’s not done yet. There is another file you have to edit. Run this command:
nano /etc/resolv.conf
Now add following line at very top of any lines you see there:
search domain.com
Once done, press Control+O to save followed by Control+X to exit. That is it. But to make sure that Bind9 can apply all recent changes above, you better restart Bind9 service using this command:
/etc/init.d/bind9 restart



In this case lets install additional tool called “DNS Utility”. Here’s how to install it:

apt-get install dnsutils

Once the install process finished, type following command:

dig domain.com

If everything is set correctly you’ll see something like this one below. ;

<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.2 <<>> 1gbits.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29677 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;1gbits.com.                    IN      A ;; ANSWER SECTION: 1gbits.com.             289     IN      A       xx.xx.xx.xx 1gbits.com.             289     IN      A       xx.xx.xx.xx ;; Query time: 60 msec ;; SERVER: ;; WHEN: Wed Nov  2 05:43:46 2016 ;; MSG SIZE  rcvd: 60

author img


Generic placeholder image

2020 Nov 19, 20:11:21

Hi there, everything is going nicely here and ofcourse every one is sharing facts, that's really excellent, keep up writing.

Leave A Comment