Configuration of DNS Server
(catching Recursion and forwarders)
Snapshot1 :
Change password for both root and shuhari user.
# nano /etc/apt/sources.list
deb [trusted=1] http://192.168.1.251/sw/repo/deb10/ buster main
deb http://deb.debian.org/debian buster main
#apt-get update
#apt-get install apache2 -y && apt-get install openssh-server -y && apt-get install sudo -y
#visudo
shuhari ALL(ALL:ALL)
Logout and login as shuhari and run any sudo command .
DNS : Domain name system port 53
1)
$ sudo apt-get install bind9 -y && sudo apt-get install bind9utils && sudo apt-get install dnsutils -y
(install necessary packages )*dynamic ip is required for this .
2) Configure static IP .(range 3-127)
a) Edit->network editor->change setting -> vmnet 8 or any adapter -> untick local dhcp server
( this we have done to turn off dhcp server or don’t allow server to allocate dynamic ip )
b) Edit configuration file .
$ sudo nano /etc/network/interfaces. (ctrl+o -> enter -> ctrlX)
$sudo reboot
C) Edit configuration files: (before editing ensure backup)
$ sudo cp /etc/bind/named.conf.options /etc/bind/named.conf.options.backup
$sudo nano /etc/bind/named.conf.options.
acl goodclients {
192.168.80.0/24;
localhost;
localnets;
};
Options-> directory->
Recursion yes; (A recursive DNS lookup is where one DNS server communicates with several other DNS servers to
hunt down an IP address and return it to the client.)
$sudo named-checkconf (to check error in configuratuion files )
$sudo systemctl restart bind9
$sudo systemctl status bind9 (active:running)
Checking:
D ) VM Windows -> win+r->ncpa.cpl->ethernet properties ->ipv4->preferred dns server 8.8.8.8
E ) VM windows -> cmd -> nslookup -> www.shuharilabs.com
Answer should be non -authorative ./server : DNS server /address: 8.8.8.8
=======================================================================================
Forwarding
$ sudo nano /etc/bind/named.conf.options
(comment // recusrion and uncomment forwarders and add 8.8.8.8 inplace of 0.0.0.0
All steps remain same as mentioned above.
Packet Capturing.
$sudo apt-get install tcpdump
$sudo tcpdump -w dns.pcap (it will capture packets keep it on )
Go to VM windows ->win+r->ncpa.cpl->preferred dns server 8.8.8.8->cmd >nslookup>www.xyz.com
Winscp->insert ip where dns is configured->transfer pcap file to window ->open it with wireshark.
Result:
=======================================================================================
$sudo cp /etc/bind/db.local /etc/bind/db.shuharilabs.local (creating a copy of config file )
Before configuration:
After Configuration:
$sudo nano /etc/bind/named.conf.local
$ sudo systemctl restart bind9
$ sudo system status bind9 (active:running)
Testing:(it will be performed on VM windows )
Vm windows (win+r, ncpa.cpl, properties allot static ip and subnet mask and debian ip in preff dns ser)
$sudo nano /etc/resolv.conf -> instead of nameserver write IP of that debian.
VM Windows ->cmd->nslookup->…
=======================================================================================
Cname
Reverse lookup ( IP ---> name)
$sudo cp /etc/bind/db.127 /etc/bind/db.127.backup (db.127 is file to allow server to search name for an
IP )
1)Creating a new file with our IP name till three places.(db.192.168.80)
$sudo cp /etc/bind/db.127 /etc/bind/db.192.168.80
2)Edit the configuration file
$sudo nano /etc/bind/db.192.168.80
Before Config
After configuration .
Editing the config file
$sudo nano /etc/bind/named.conf.local (add zone for IP to name )
Testing:(Vm windows -> win r->cmd)
Om Digitally
signed by
Omkar Ojas
kar Date:
2023.04.08
Ojas 20:07:33
+05'30'