014.01.40.2. Walk us through the typical process of hostname resolution in Linux, from the application calling a function to the final retrieval of the IP address.
The application calls a function to lookup the IP address behind a hostname. This function is in the system's shared library, so the application doesn't need to know the details of how it works or whether its implementation will change.
When the function in the shared library runs, it acts according to a set of rules(found in /etc/nsswitch.conf) to determine a plan of action on lookups.
When the function decides to use DNS for the name lookup, it consults an additional configuration file to find a DNS name server. The name server is given an IP address.
This function sends a DNS lookup request to the name server.
The name server replies with IP address for the hostname, the function returns this address to the application.