DNS Server
DNS (Domain Name Server) is an Internet service which translates domain names into IP addresses. Each time you use a domain name, DNS translates the name into the corresponding IP address
Each website has IP address to brows Internet.. we cant memorize all IP addresses. So this service mainly done by DNS server.
Early day DNS use central body protocol carryout this task, Now uses Distributed protocol.
Transport layer DNS use UDP port 53.
BIND(Berkeley Internet Name Domain) is a free open source DNS sserver.
Configuration of BIND(DNS server)
Installation in DNS server on Ubuntu
To setting up DNS server on your mechine through vim editor
After change the file hit Esc and :qw! to save the file
Then open the file
Change as above show
and then Open your terminal and check whether your DNS server is working or not
Now we can see how DNS server is working. When we brows a website (www.jfn.ac.lk)
See the bottom of above picture when we brows the website at first the Query time is 2341msec
But, you can see the below picture when we brows same website at 2nd time the Query time is 0msec.
This is the way caching is working.
DNS records
In order to do the translation DNS holds records for each domain such as A,CNAME,MIX records.
Dig is used to look up the Arecord for the domain name.
meanings of above output
for more detail check this link https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2
To filter the details type below command on terminal. It shows the IP address of he domain name
Using he IP address we can get the associated domain / hostname. An a record should exist for every PTR reord.
Usage of reverse DNS setup for mail server is good solution.
Domain Name ---------> IP Address
Reverse DNS
IP address ---------> Domain Name
For an Example :
www.example.com IP Address : 192.168.0.2
Reverse DNS requires a special DNS domain
It reverse the IP address ending with In Address Arpa
for an example
2.0.168.192.in-addr.arpa
PTR are configured within "In Address arpa" which is define the revere DNS for each host on the network.
example :
an A record for example.com ------------> 192.168.0.2
In PTR of the reverse database, this IP address is stored as the domain name. As I mentioned above (2.0.168.192.in-addr.arpa) It pointing back to its host name example.com
When a mail server receives an email,a three way handshake takes place to verify the sending server.
When the three-way check passes, the email is delivered into client mail inbox. If it check fail, the mail is either reject or delivered to the client spam folder.
Each website has IP address to brows Internet.. we cant memorize all IP addresses. So this service mainly done by DNS server.
Early day DNS use central body protocol carryout this task, Now uses Distributed protocol.
Transport layer DNS use UDP port 53.
BIND(Berkeley Internet Name Domain) is a free open source DNS sserver.
Configuration of BIND(DNS server)
Installation in DNS server on Ubuntu
sudo apt-get install bind9
To setting up DNS server on your mechine through vim editor
vim /etc/bind/named.conf.options
forwarders {
8.8.8.8; //edit those IP addresses
8.8.4.4;
192.168.2.240;
192.168.2.241;
};
After change the file hit Esc and :qw! to save the file
Then open the file
vim /etc/resolv.conf
Change as above show
and then Open your terminal and check whether your DNS server is working or not
dig www.google.com
Now we can see how DNS server is working. When we brows a website (www.jfn.ac.lk)
See the bottom of above picture when we brows the website at first the Query time is 2341msec
But, you can see the below picture when we brows same website at 2nd time the Query time is 0msec.
This is the way caching is working.
DNS records
In order to do the translation DNS holds records for each domain such as A,CNAME,MIX records.
- A records : holds Host IP address.
- CNAME records : holds an Alias IP records.
- canonical name for an alias
- it is used to give multiple aliases to a single computer.
- MIX records : Mail exchange records.
- It's ells mail servers how to route email for this domain.
Dig is used to look up the Arecord for the domain name.
; <<>> DiG 9.10.3-P4-Debian <<>> www.csc.jfn.ac.lk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10625
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 5, ADDITIONAL: 5
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.csc.jfn.ac.lk. IN A
;; ANSWER SECTION:
www.csc.jfn.ac.lk. 4211 IN CNAME www.jfn.ac.lk.
www.jfn.ac.lk. 83 IN A 192.248.56.21
;; AUTHORITY SECTION:
ac.lk. 81 IN NS d.nic.lk.
ac.lk. 81 IN NS t.nic.lk.
ac.lk. 81 IN NS ns1.ac.lk.
ac.lk. 81 IN NS c.nic.lk.
ac.lk. 81 IN NS ns2.ac.lk.
;; ADDITIONAL SECTION:
ns1.ac.lk. 6493 IN A 192.248.1.162
ns2.ac.lk. 81 IN A 192.248.1.161
ns1.ac.lk. 6493 IN AAAA 2401:dd00:1::162
ns2.ac.lk. 81 IN AAAA 2401:dd00:1::161
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Feb 06 11:00:55 +0530 2018
;; MSG SIZE rcvd: 256
meanings of above output
DiG 9.10.3-P4-Debian : Tell the version of Dig
www.csc.jfn.ac.lk ;; global options: +cmd : this is said that the query option
opcode: QUERY : This line in header of the response. It reports which an answer was obtained from he query response.It response contain one answer,
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 5, ADDITIONAL: 5
flags are used to note certain things about the DNS server its response
qr : Query/Rsponse
Query :0
Response : 1
rd : Recursion Desired
Recursion not desired : 0
Recursion desired :1
ra : Recursion Available
Recursive query support not available : 0
Recursive query support available. : 1
ad : Authenticated data
It indicate in response that all data included in the answer and authority sections of the response have been authenticated by the server according to the policies of that resonseof that server
aa : Authoritative Answer
It specify that the responding name server is an authority of the domain name question section.
contents of the answer section may have multiple owner names because of aliases
This bit corresponds to the name which matches the query name, or the first owner name in the answer section.
Not Authoritative : 0
Is Authoritative : 1
tc : Turncated
Not turncated : 0
Message truncated :1
AAAA : IP6 address
IN
: Internet lookup (in the Internet class).
NS : an authoritative name server .
MD : Mail Destination (OBSOLETE -use MX)
MF : Mail Forward
SOA : marks the start of zone of authority
MB ; mailbox domain name (EXERIMENTAL)
MR : mail rename domain name
MG : mail group member.
PTR : domain name pointer
WKS : well known service description.
HINFO :host information
MINFO : Mail list information.
MX : mail exchange
RT : route through
SIG : security signature
KEY : security key
for more detail check this link https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2
To filter the details type below command on terminal. It shows the IP address of he domain name
dig www.dialog.lk +short
PTR Records
Pointer records are used to map a network interface (IP) to host name.These are primarily used for reverse DNSUsing he IP address we can get the associated domain / hostname. An a record should exist for every PTR reord.
Usage of reverse DNS setup for mail server is good solution.
Reverse DNS
Forward DNSDomain Name ---------> IP Address
Reverse DNS
IP address ---------> Domain Name
For an Example :
www.example.com IP Address : 192.168.0.2
Reverse DNS requires a special DNS domain
It reverse the IP address ending with In Address Arpa
for an example
2.0.168.192.in-addr.arpa
PTR are configured within "In Address arpa" which is define the revere DNS for each host on the network.
example :
an A record for example.com ------------> 192.168.0.2
In PTR of the reverse database, this IP address is stored as the domain name. As I mentioned above (2.0.168.192.in-addr.arpa) It pointing back to its host name example.com
When a mail server receives an email,a three way handshake takes place to verify the sending server.
- Forward DNS check.
- Reverse DNS check.
- FQDN (Fully qualified Domain Name) Header check.
When the three-way check passes, the email is delivered into client mail inbox. If it check fail, the mail is either reject or delivered to the client spam folder.
Comments