How To Install DNS Server (Bind9) On Ubuntu 18.04

Sharing is caring!

DNS refers to Domain Name System. It is very import for your local network and public network. So I want to show step by step guide for DNS server how to install and configure DNS (Bind9) on local network.

 How To Install DNS (Bind9) On Ubuntu 16.04
 How To Install DNS (Bind9) On Ubuntu 14.04

System requirements :

  • Ubuntu 18.04 VPS or local machine
  • RAM 1 GB (More best performance)
  • LAN interface
  • SSH enable

My Server IP Address : 10.66.40.50

Name server : ns1.technologyrss.local

[email protected]:~# apt update && apt upgrade -y

Change server host name like as below. Open hosts file via any editor.

[email protected]:~# vi /etc/hosts

127.0.0.1 localhost 10.66.40.50 ns1.technologyrss.local ns1

then save it Esc :wq press Enter.

And then change another file open using below command

[email protected]:~# vi /etc/hostname

ns1

then save it Esc :wq press Enter.

Now reboot your server using command

[email protected]:~# reboot
[email protected]:~# vi /etc/resolv.conf

nameserver 10.66.40.50 nameserver 8.8.8.8

then save it Esc :wq press Enter.

Now Install DNS (Bind9) server using command below

[email protected]:~# apt-get install bind9 bind9utils bind9-doc -y
[email protected]:~# cd /etc/bind/

Now backup or copy default named.conf.local file.

[email protected]:/etc/bind# cp named.conf.local named.conf.local.back

db.local file is zone file that means forward and reverse zone. So I copy (db.local) file for two purposes.

This one forward zone file.

[email protected]:/etc/bind# cp db.local db.fwd.technologyrss.local

Another one reverse zone file.

[email protected]:/etc/bind# cp db.local cp db.local db.rev.technologyrss.local

Now create zones folder using command

[email protected]:/etc/bind# mkdir /etc/bind/zones

Move created two file into /etc/bind/zones folder.

[email protected]:/etc/bind# mv db.fwd.technologyrss.local zones [email protected]:/etc/bind# mv db.rev.technologyrss.local zones

[email protected]:/etc/bind# vi named.conf.local

Insert below text after default text then save it.

zone “technologyrss.local” IN { type master; file “/etc/bind/zones/db.fwd.technologyrss.local”; allow-update { none; }; // Since this is the primary DNS, it should be none. }; //Reverse lookup name, should match your network in reverse order zone “66.10.in-addr.arpa” IN { type master; file “/etc/bind/zones/db.rev.technologyrss.local”; allow-update { none; }; //Since this is the primary DNS, it should be none. };

then save it Esc :wq press Enter.

Note : Server IP 10.66.40.50 so This first two 66.10. 

[email protected]:/etc/bind# vi named.conf.options

Insert all information into named.conf.options file then save it.

acl “Trusted” { 10.66.40.50; # Name Server }; options { directory “/var/cache/bind”; recursion yes; # enables resursive queries allow-recursion { Trusted; }; # allows recursive queries from “trusted” clients listen-on { 10.66.40.50; }; # ns1 private IP address – listen on private network only allow-transfer { none; }; # disable zone transfers by default forwarders { 8.8.8.8; 8.8.4.4; }; dnssec-validation auto; auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; }; };

then save it Esc :wq press Enter.

[email protected]:/etc/bind# cd zones

Now open forward zone file via any editor.

[email protected]:/etc/bind/zones# vi db.fwd.technologyrss.local

Sample below my config you can change it for your domain name.

; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA ns1.technologyrss.local. root.ns1.technologyrss.local. ( 6 604800 86400 2419200 604800 ) ; @ IN NS localhost. @ IN A 127.0.0.1 @ IN AAAA ::1 ;Name Server Information IN NS ns1.technologyrss.local. ;Name Server A records ns1.technologyrss.local. IN A 10.66.40.50

then save it Esc :wq press Enter.

[email protected]:/etc/bind/zones# vi db.rev.technologyrss.local

Sample below my config you can change your domain name.

; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA ns1.technologyrss.local. root.ns1.technologyrss.local. ( 5 604800 86400 2419200 604800 ) ; @ IN NS localhost. @ IN A 127.0.0.1 @ IN AAAA ::1 ;Name Server Information IN NS ns1.technologyrss.local. ;PTR records from ip last two part 40.50 IN PTR ns1.technologyrss.local.

then save it Esc :wq press Enter.

My server IP address 10.66.40.50 so it last two 40.50 PTR record.

Now bind service restart

service bind9 restart

[email protected]:/etc/bind/zones# service bind9 restart

[email protected]:/etc/bind/zones# named-checkzone 66.10.in-addr.arpa db.fwd.technologyrss.local db.fwd.technologyrss.local:20: ignoring out-of-zone data (ns1.technologyrss.local) zone 66.10.in.addr.arpa/IN: loaded serial 2 OK [email protected]:/etc/bind/zones# named-checkzone 66.10.in-addr.arpa db.rev.technologyrss.local zone 66.10.in.addr.arpa/IN: loaded serial 2 OK

Step #09: Manage DNS server from web GUI so now I am install webmin into my dns server.

[email protected]:~# apt update

Add webmin repo into sources list file

[email protected]:~# vi /etc/apt/sources.list

deb http://download.webmin.com/download/repository sarge contrib deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

Check public key using below command

[email protected]:~# wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add –

Now run update command

[email protected]:~# apt-get update

Then install webmin package using below command.

[email protected]:~# apt-get install webmin

After installation done! Then login using below URL.

https://10.66.40.50:10000

All is done!

Troubleshooting !!!. Must be add name server ip as your dns server ip address. like this.

[email protected]:~# cat /etc/resolv.conf

Output like this

nameserver 10.66.40.50 nameserver 8.8.8.8 search technologyrss.local

If you see can’t save dns first time so you must be add rndc.conf file. see video last step for this config.

For more details see my YouTube video. Don’t forget subscribe my channel. Please subscribe my channel for more update.

 

Admin

I am system administrator as Windows and Linux platform. I have 4 years skilled from the professional period. I have to configure Linux based system such as an Asterisk VOIP system, Network monitoring tools (ZABBIX), Virtualization (XEN Server), Cloud computing (Apache CloudStack) etc. Now share my professional skill each interested person.
Thanks to all.

Admin

Source

Leave a Reply

Your email address will not be published. Required fields are marked *