One of the major tasks of DNS server is to respond DNS query it is also known as the DNS lookup. DNS query is something like please tell me the IP address of domain such as www.example.com. Whereas in case of reverse lookup the client wants to know domain name from given IP address.
The following figure shows DNS query example
Fig-1: DNS Query Example
Base on this task the DNS queries are divided into three categories
- Recursive Query
- Non-Recursive (iterative) Query
- Reverse Query
What is Recursive Query?
In recursive DNS query the DNS server must respond with an answer. There are three possibilities of reply to a recursive query:
- The dns server find the IP address of the domain name. The response shows whether the data is authoritative and non-authoritative. You can observe in the above fig-1 that I got response against my dns query of www.google.com. The answer comes from a non-authoritative server type (To know more about DNS server types click her).
Complete steps involved in recursive query are shown in fig-2 below
2. The server replies with an error indicating the domain name does not exist.
3. An error comes with a temporary indication saying DNS cannot be accessed due to network or system error.
Fig-2: Steps of DNS lookup
What is iterative query?
The dns server may respond with full answer or partial answer for an iterative query. All dns servers must have support for this query. There are four possibilities of reply to a non-recursive query.
- The server replies with a fully qualified domain name stored in its cache.
- An error message telling the domain doesn’t exist.
- A temporary error message due to network error.
- Server replies with a reference message containing the list of next level domain servers.
What is Reverse DNS Query?
The reverse DNS lookup is used to find the domain name from an IP address. For example in the fig-1 you can see 126.96.36.199 is the IP of Goolg’s DNS server. When I wrote this IP by using DNS lookup command. The server replied me with domain name of dns.google.
What is DNS lookup Command?
You can find the IP Address from domain name and vice versa. For that you have to follow the following steps
- On windows 10 machine click on the search button on the taskbar.
- Type “cmd” and press enter. A command window will open.
- If you want to find IP. Then type “nslookup” space “domain name” and press enter. For example “nslookup www.lecturesclub.com”.
- If you want to find domain name just type IP address in place of domain name in step three. You can see the figure-1 above.