Tele DNS

Facebook
Twitter
WhatsApp
Telegram
##################################
Operating system: Ubuntu 22.04
IP address	: 10.66.10.30
RAM		: 2GB
DISK space	: 50GB
vCPU		: 2
Service		: Local DNS
Hostname	: ns.telehouse.com.pk
##################################

root@ns:~#

 lsb_release -a && ip r
root@ns:~# apt update && apt upgrade -y

Add dns server ip into resolv.conf file.

root@ns:~# nano /etc/resolv.conf

Insert below ip into this file.

nameserver 103.166.102.6

Step #02: Configure DNS (Bind9) service.

Main configuration is 4 files like
1. named.conf.options
2. named.conf.local
3. db.fwd.technologyrss.local
4. db.rev.technologyrss.local

root@ns:~# cd /etc/bind/

Open named.conf.options file then delete all default text.

root@ns/etc/bind/# nano named.conf.options

Then add below text into named.conf.options file.

acl "Trusted" {
        103.166.102.6;    # ns1 - can be set to localhost
};


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 { 103.166.102.6; };   # 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;

        listen-on-v6 { any; };
};

Then save press Esc type :wq then press Enter.

Open named.conf.local file then delete all default text.

root@ns/etc/bind/# nano named.conf.local

Then add below text into named.conf.local file.

zone "ns4.telehouse.com.pk" {
    type master;
    file "/etc/bind/zones/db.fwd.ns4.telehouse.com.pk"; # zone file path
    allow-transfer { 103.166.102.6; };           # ns private IP address
};


zone "166.103.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/db.rev.ns4.telehouse.com.pk";  # 10.55.0.0/16 subnet
    allow-transfer { 103.166.102.6; };  # ns private IP address
};

Then save press Esc type :wq then press Enter.

Create zones folder for store two files.

root@ns/etc/bind/# mkdir zones

Then going to this directory

root@ns/etc/bind/# cd zones/

Then create forwarder zone file.

root@ns/etc/bind/zones# nano db.fwd.ns4.telehouse.com.pk

Insert below all text into this file.

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns4.telehouse.com.pk. root.ns4.telehouse.com.pk. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
; name servers - NS records
     IN      NS      ns4.telehouse.com.pk.

; name servers - A records
ns4.telehouse.com.pk.          IN      A       103.166.102.6
;

Then save press Esc type :wq then press Enter.

Then create reverse zone file.

root@ns/etc/bind/zones# nano db.rev.ns4.telehouse.com.pk

Then insert below all text into this file.

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns4.telehouse.com.pk. root.ns4.telehouse.com.pk. (
                        5
                        604800
                        86400
                        2419200
                        604800 )

; name servers
      IN      NS      ns4.telehouse.com.pk.


6.102      IN      PTR    ns4.telehouse.com.pk.

Then save press Esc type :wq then press Enter.

Then back one directory

root@ns/etc/bind/zones# cd /etc/bind/

Then show rndc.key info using cat command.

root@ns/etc/bind# cat rndc.key

See output as like below

key "rndc-key" {
        algorithm hmac-sha256;
        secret "BPHuhhHVX+CoLmmw6hfwh9a0R5CyRHOhNuPyqvogfps=";
};

Now Create rndc.conf file.

root@ns/etc/bind# nano rndc.conf

Then insert below all text into this file.

key "rndc-key" {
        algorithm hmac-sha256;
        secret "BPHuhhHVX+CoLmmw6hfwh9a0R5CyRHOhNuPyqvogfps=";
};
options {
        default-key "rndc-key";
        default-server 103.166.102.6;
        default-port 953;
};

Then save press Esc type :wq then press Enter.

Step #03: Setup permission and restart bind9 service.

root@ns/etc/bind# chown root:bind -R /etc/bind
root@ns/etc/bind# chown bind:bind -R /etc/bind/rndc.conf
root@ns/etc/bind# service bind9 restart
root@ns/etc/bind# service bind9 status

Now Test bind9 service from server.

root@ns:~# dig ns4.telehouse.com.pk

; <<>> DiG 9.18.1-1ubuntu1.1-Ubuntu <<>> ns.technologyrss.local
;; global options: +cmd
;; Got answer:
;; WARNING: .local is reserved for Multicast DNS
;; You are currently testing what happens when an mDNS query is leaked to DNS
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28146
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: a3f823b21fb8bab30100000062efd60632ef06dae70dc94c (good)
;; QUESTION SECTION:
;ns4.telehouse.com.pk.                IN      A

;; ANSWER SECTION:
ns4.telehouse.com.pk. 604800  IN      A       103.166.102.6

;; Query time: 0 msec
;; SERVER: 10.66.10.30#53(10.66.10.30) (UDP)
;; WHEN: Sun Aug 07 15:11:02 UTC 2022
;; MSG SIZE  rcvd: 95

Check PTR resolver using below command.

root@ns:~# dig -x  103.166.102.6

; <<>> DiG 9.18.1-1ubuntu1.1-Ubuntu <<>> -x 10.66.10.30
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65521
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 771c99bb327d4ea90100000062efd7fc00b78df9640350c7 (good)
;; QUESTION SECTION:
;30.10.66.10.in-addr.arpa.      IN      PTR

;; ANSWER SECTION:
30.10.66.10.in-addr.arpa. 604800 IN     PTR     ns.technologyrss.local.

;; Query time: 0 msec
;; SERVER: 10.66.10.30#53(10.66.10.30) (UDP)
;; WHEN: Sun Aug 07 15:19:24 UTC 2022
;; MSG SIZE  rcvd: 117

Check name test.

root@ns:~# nslookup ns
Server:         10.66.10.30
Address:        10.66.10.30#53

Name:   ns.technologyrss.local
Address: 10.66.10.30

Check ip test.

root@ns:~# nslookup 10.66.10.30
30.10.66.10.in-addr.arpa        name = ns.technologyrss.local.

Step #04: Now Install how to manage DNS server from web GUI.

root@ns:~# nano /etc/apt/sources.list

Insert below text into this file.

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

or

You can use different method as like below.

root@ns:~# wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add -
root@ns:~# sudo add-apt-repository "deb http://download.webmin.com/download/repository sarge contrib"

Then update and then install webmin package.

root@ns:~# apt-get update
root@ns:~# apt-get install webmin -y

Now access your server ip address using port 10000

https://10.66.10.30:10000

Making the internet work for you

Ultricies augue id venenatis at egestas aenean semper ac lectus praesent consequat.

Signup our newsletter to get update information, news, insight or promotions.

Popular Categories

Latest Post
Scroll to Top