Solaris Troubleshooting : How DNS Name Resolution works
In this post, I’m just trying to travel with the server to know how it resolves a hostname using the DNS name resolution.
To use an example, let’s say a user is trying to ftp to ftp.internic.net from a client machine. The client machine resolution process uses the following steps:
1. The client system consults the / etc/nsswitch.conf file to determine the name resolution order. In this example, the presumed order is local files first, NIS+ server second, and DNS third.
2. The client system consults the local /etc/inet/hosts file and does not find an entry.
3. The client system sends a query regarding the address of ftp.internic.net to the NIS+ server and finds none.
4. Since the next entry in /etc/nsswith.conf is “DNS”, the client system consults the /etc/resolv.conf file to determine the name resolution search list and the address of the local DNS server.
5. The client system resolver routines send a recursive DNS query regarding the return address of ftp.internic.net to the local DNS server. At this point, the client will wait until the local server has completed name resolution.
6. The local DNS server consults the contents of its cached information in case this query has been tried recently. If the answer is in local cache, it is returned to the client as a non-authoritative answer.
7. The local DNS server contacts the appropriate DNS server for the internic.net domain (if known) or a root server, and sends an iterative query. In this example, the assumption is that the answer is not cached and root server must be contacted.
8. The root server returns the best information it has. In this case, the only information you can be guaranteed that the root server will have is the names and addresses of all the net.servers. The root server returns these names and addresses along with a time-to-live value specifying how long the local name server can cache this information.
9. The local DNS server contacts one of the net.servers returned from the previous query, and transmits the same iterative query sent to the root servers earlier.
10. The net.server contacted returns the best information it has, which is the names and addresses of the internic.net. servers along with a time-to-live value.
11. The local DNS server contacts one of the internic.net. servers and makes the same query.
12. The internic.net. servers return the address of the ftp.internic.net along with the time-to-live value.
13. The local DNS server returns the requested address to the client system and the ftp command can proceed.
14. Now this address for ftp.internic.net will be cached in local DNS server for future queries.