Working Overview of DNS
Lets look the working overview of DNS
The basic function of DNS is to resolve IP address from domain name. We must know the basics of
DNS before proceeding further
Suppose, you are searching the domain http://www.example.com in your browser,
The first step is that the query checks to which file or service it should search for the IP address. The order is
specified in /etc/nsswitch.conf.
There the entry will be specified as like
************
hosts: files dns
************
Which means, for programs that want to resolve an address. They should use the files present in the
system (E.g./etc/hosts,) first, and then DNS servers.
In our case it will first check for the IP address of example.com in the /etc/hosts file and if it fails to find it, then it will check for DNS.
The resolver library used by BIND needs a configuration file which specifies the name servers and it is /etc/resolv.conf. If this file does not exist or is empty, the resolver assumes the name server is on your local host.
Example of /etc/resolv.conf file:
[root@example.com]# cat /etc/resolv.conf
nameserver 205.261.63.19
nameserver 4.2.2.1
nameserver 4.2.2.2
The entries mean that the DNS resolver need to forward the query to the name servers in the
specified order.
In most cases, these name servers will be the ISP name servers. Once the request reaches the name server, it checks if there is any valid DNS record for the example.com resides in its cache (most ISPs or name serves will have their own cache to reduce seek time for common domains). If so it will retrieve the record otherwise it will proceed further as follows
The resolver breaks the domain name into its labels from right to left. The first component will be .com, .org etc and the servers which contain the NS records for the TLDs are termed as root name servers. In this case since the domain is a .com, the query will be forwarded to root name server for the .com TLD. The root name server returns the authoritative name servers for example.com
[root@example.com]# host -t NS example.com
example.com name server ns1.example.com.
example.com name server ns2.example.com.
The name servers too will go through a registration process identical with domain registration. The NS admin has to specify the IP address for each of the name servers like the NS record specification in the case of domain registration.
[root@example.com]# host ns1.example.com.
ns1.supportsages.com has address 192.158.45.12
[root@example.com]# host ns2.example.com.
ns2.supportsages.com has address 192.158.45.13
Once the Name servers for the domain are identified, the query will be forwarded to the assigned name servers i.e. to the assigned IPs. The request will be processed there and check if a valid zone for the domain is available here. If the required data is found here, it will return the record otherwise it reports failure in DNS resolution.
Lets look the working overview of DNS
The basic function of DNS is to resolve IP address from domain name. We must know the basics of
DNS before proceeding further
Suppose, you are searching the domain http://www.example.com in your browser,
The first step is that the query checks to which file or service it should search for the IP address. The order is
specified in /etc/nsswitch.conf.
There the entry will be specified as like
************
hosts: files dns
************
Which means, for programs that want to resolve an address. They should use the files present in the
system (E.g./etc/hosts,) first, and then DNS servers.
In our case it will first check for the IP address of example.com in the /etc/hosts file and if it fails to find it, then it will check for DNS.
The resolver library used by BIND needs a configuration file which specifies the name servers and it is /etc/resolv.conf. If this file does not exist or is empty, the resolver assumes the name server is on your local host.
Example of /etc/resolv.conf file:
[root@example.com]# cat /etc/resolv.conf
nameserver 205.261.63.19
nameserver 4.2.2.1
nameserver 4.2.2.2
The entries mean that the DNS resolver need to forward the query to the name servers in the
specified order.
In most cases, these name servers will be the ISP name servers. Once the request reaches the name server, it checks if there is any valid DNS record for the example.com resides in its cache (most ISPs or name serves will have their own cache to reduce seek time for common domains). If so it will retrieve the record otherwise it will proceed further as follows
The resolver breaks the domain name into its labels from right to left. The first component will be .com, .org etc and the servers which contain the NS records for the TLDs are termed as root name servers. In this case since the domain is a .com, the query will be forwarded to root name server for the .com TLD. The root name server returns the authoritative name servers for example.com
[root@example.com]# host -t NS example.com
example.com name server ns1.example.com.
example.com name server ns2.example.com.
The name servers too will go through a registration process identical with domain registration. The NS admin has to specify the IP address for each of the name servers like the NS record specification in the case of domain registration.
[root@example.com]# host ns1.example.com.
ns1.supportsages.com has address 192.158.45.12
[root@example.com]# host ns2.example.com.
ns2.supportsages.com has address 192.158.45.13
Once the Name servers for the domain are identified, the query will be forwarded to the assigned name servers i.e. to the assigned IPs. The request will be processed there and check if a valid zone for the domain is available here. If the required data is found here, it will return the record otherwise it reports failure in DNS resolution.