How To Install DNS Server (Bind9) On Ubuntu 20.0411 min read
Now I want to share the dens server installation process on your Ubuntu 20.04 server. DNS server very important tools for your network because many IP address can’t remember so can remember dns name.
★ How To Install OpenProject Into Ubuntu 18.04
★ How To Upgrade Zabbix Server From 3.2.6 To 3.4.1
- My server info :
- Server IP : 10.66.11.15
- Disk : 25 GB
- RAM : 1GB
- vCPU : 2
- Service : DNS (bind9)
- Webmin [For manage dns from browser]
Step #01: Prepare your server using change hostname ip or update.
root@ubuntu20:~# lsb_release -a root@ubuntu20:~# ip r root@ubuntu20:~# apt update && apt upgrade -y root@ubuntu20:~# vi /etc/hosts
Insert server ip address and hostname into hosts file.
127.0.0.1 localhost 10.66.11.15 ns1.technologyrss.local ns1
Again open vi /etc/hostname file and add server hostname.
ns1
Also open vi /etc/cloud/cloud.cfg file and must be set preserve_hostname: true
preserve_hostname: true
Then reboot your server using command.
root@ubuntu20:~# reboot
Step #02: Add nameserver ip address as your server ip address into /etc/resolv.conf file.
root@ns1:~# vi /etc/resolv.conf
Insert below details like
nameserver 10.66.11.15 options edns0 search technologyrss.local
Step #03: Now install dns (bind9) package using below command.
root@ns1:~# apt-get install bind9 bind9utils bind9-doc -y root@ns1:/etc/bind# cd /etc/bind/ root@ns1:/etc/bind# cp named.conf.local named.conf.local.back root@ns1:/etc/bind# cp db.local db.fwd.technologyrss.local root@ns1:/etc/bind# cp db.local db.rev.technologyrss.local root@ns1:/etc/bind# mkdir /etc/bind/zones root@ns1:/etc/bind# mv db.fwd.technologyrss.local zones root@ns1:/etc/bind# mv db.rev.technologyrss.local zones root@ns1:/etc/bind# vi named.conf.local
Delete all text from named.conf.local and insert below text. Must be replace your server ip address and file name.
// // Do any local configuration here // // Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918"; 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. };
My dns Server IP 10.66.11.15 so This is first two 66.10 use as reverse PTR.
Then save Press Esc type :wq the press Enter.
root@ns1:/etc/bind# vi named.conf.options
Delete all text from named.conf.options and insert below text. Must be replace your server ip address and file name.
acl "Trusted" { 10.66.11.15; # Name Server }; options { directory "/var/cache/bind"; // If there is a firewall between you and nameservers you want // to talk to, you may need to fix the firewall to allow multiple // ports to talk. See http://www.kb.cert.org/vuls/id/800113 // If your ISP provided one or more IP addresses for stable // nameservers, you probably want to use them as forwarders. // Uncomment the following block, and insert the addresses replacing // the all-0's placeholder. recursion yes; # enables resursive queries allow-recursion { Trusted; }; # allows recursive queries from "trusted" clients listen-on { 10.66.11.15; }; # 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; }; // forwarders { // 0.0.0.0; // }; //======================================================================== // If BIND logs error messages about the root key being expired, // you will need to update your keys. See https://www.isc.org/bind-keys //======================================================================== dnssec-validation auto; auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; }; };
Then save Press Esc type :wq the press Enter.
Step #04: Goto your zones folder and edit forward and reverse file.
root@ns1:/etc/bind# cd zones root@ns1:/etc/bind/zones# vi db.fwd.technologyrss.local
Delete all text and add below all code into db.fwd.technologyrss.local file. And must be replace your server ip address and hostname.
; ; 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.11.15
Then save Press Esc type :wq the press Enter.
Now open reverse file db.rev.technologyrss.local
root@ns1:/etc/bind/zones# vi db.rev.technologyrss.local
And delete all text from db.rev.technologyrss.local and inert below text into this file. Must be change hostname and PTR last octet as your own server details.
; ; 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 11.15 IN PTR ns1.technologyrss.local.
Then save Press Esc type :wq the press Enter.
Note : My IP address 10.66.11.15 so it last two 11.15 PTR record. this is third octet is first and last octet is second.
Step #05 : Now restart dns service and check all is ok.
root@ns1:/etc/bind/zones# service bind9 restart root@ns1:/etc/bind/zones# service bind9 status root@ns1:/etc/bind/zones# named-checkzone 66.10.in-addr.arpa db.fwd.technologyrss.local root@ns1:/etc/bind/zones# named-checkzone 66.10.in-addr.arpa db.rev.technologyrss.local
This is advanced option for manage DNS from browser.
Now I am install webmin for manage dns server from browser.
root@ns1:/etc/bind/zones# cd root@ns1:~# apt update root@ns1:~# vi /etc/apt/sources.list
Then save Press Esc type :wq the press Enter.
Insert below two lines into sources.list for install webmin.
deb http://download.webmin.com/download/repository sarge contrib deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
or.
you can use below details for install webmin manage dns server.
root@ns1:~# wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add - root@ns1:~# sudo add-apt-repository "deb http://download.webmin.com/download/repository sarge contrib" root@ns1:~# apt-get update root@ns1:~# apt-get install webmin -y
Now browse server ip address using webmin default port. https://10.66.11.15:10000
Resolve rndc error using create rndc.key file.
read rndc.key file using cat command.
root@ns1:/etc/bind/# cat rndc.key
key "rndc-key" {
algorithm hmac-sha256;
secret "aj8uPMxFxe1XE8qZuY9Zjd1vp3S6VeY2fweQwtxUxDg=";
};
Now inert below text as your file details.
############rndc-key collect from rndc-key file############ key "rndc-key" { algorithm hmac-sha256; secret "aj8uPMxFxe1XE8qZuY9Zjd1vp3S6VeY2fweQwtxUxDg="; }; options { default-key "rndc-key"; default-server 127.0.0.1; default-port 953; };
Then save Press Esc type :wq the press Enter.
New see more details from my YouTube channel. Please subscribe my channel for more update.
- How To Install Zabbix Server 6.4 On AlmaLinux 8 Server - August 9, 2024
- How To Clear RAM Memory Cache Buffer Linux Server - February 29, 2024
- How To Install Apache Cloud Stack Management Server 4.17 On Ubuntu 22.04 - February 1, 2024
We really appreciate for your support for buying me a coffee.
It takes us a while to compose and upload new content, as they have to be checked to see if Properly works. We appreciate you if you help me for one cup of coffee to keep us awake and always deliver good quality content.
No contribution is small of an amount. We are grateful for any amount you support us with. Thank you!
hey i saw an error between your video and the things on this page
what is error?
Thanks.
you seem missed the name.config.loca, and named.config.local.option
Please see from step #03 last option, However this is not name.config.local it should be named.conf.local
Thank you so much!
Hi Bro,
under the below lines you had given the entries of the file named.conf.options instead of named.conf.local in your blog . Please find the attached screenshot
============================
Delete all text from named.conf.local and insert below text. Must be replace your server ip address and file name.
could you please share the entries of the file named.conf.local as per your video.
Thank you!!
Updated this post, Thank you so much!
Now enjoy this post.