Configuration of DNS Server
(catching Recursion and forwarders)
Snapshot1 :
Change password for both root and shuhari user.
# nano /etc/apt/[Link]
deb [trusted=1] [Link] buster main
deb [Link] 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/[Link] /etc/bind/[Link]
$sudo nano /etc/bind/[Link].
acl goodclients {
[Link]/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->[Link]->ethernet properties ->ipv4->preferred dns server [Link]
E ) VM windows -> cmd -> nslookup -> [Link]
Answer should be non -authorative ./server : DNS server /address: [Link]
=======================================================================================
Forwarding
$ sudo nano /etc/bind/[Link]
(comment // recusrion and uncomment forwarders and add [Link] inplace of [Link]
All steps remain same as mentioned above.
Packet Capturing.
$sudo apt-get install tcpdump
$sudo tcpdump -w [Link] (it will capture packets keep it on )
Go to VM windows ->win+r->[Link]->preferred dns server [Link]->cmd >nslookup>[Link]
Winscp->insert ip where dns is configured->transfer pcap file to window ->open it with wireshark.
Result:
=======================================================================================
$sudo cp /etc/bind/[Link] /etc/bind/[Link] (creating a copy of config file )
Before configuration:
After Configuration:
$sudo nano /etc/bind/[Link]
$ sudo systemctl restart bind9
$ sudo system status bind9 (active:running)
Testing:(it will be performed on VM windows )
Vm windows (win+r, [Link], properties allot static ip and subnet mask and debian ip in preff dns ser)
$sudo nano /etc/[Link] -> 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/[Link] (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/[Link] (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'