# cat /etc/nsswitch.conf
...
hosts: files ldap dns
...
#
- The client system consults the /etc/nsswitch.conf file to
determine the name resolution order. In this example, the order is the
local file, the Lightweight Directory Access Protocol (LDAP) server,
and then the DNS server.
- The client system consults the local /etc/inet/hosts file and does not find an entry. (files /etc/inet/hosts)
- The client system sends a query asking for the IP address of the Internet name, ftp.internic.net., to the LDAP server and finds no address.
- The client system consults the /etc/resolv.conf file to determine the name resolution search list and the address of the DNS servers.
- The client system resolver routine sends a recursive DNS query asking for the IP address for the Internet name, ftp.internic.net.,
to the local DNS server. A recursive query states: "I will wait for the
answer, and you do all of the work." The client waits until the local
server completes name resolution.
- The local DNS server consults the contents of its cached
information in case this query has been recently resolved. If the
address is in the local cache, it is returned to the client as a
non-authoritative answer.
- If the local DNS server does not have cached information about the net or internic
domains, it contacts one of the root servers and sends an iterative
query. An iterative query states: "Send me the best answer you have,
and I will do all of the work." In this example, the assumption is that
the answer is not cached and that a root server must be contacted.
- The root server returns the best information it has. In this case,
the only information you are guaranteed is that the root server has the
names and addresses of all the net domain servers. The root
server returns these names and addresses along with a TTL value that
specifies how long the local DNS server can cache this information.
- The local DNS server contacts one of the net domain
servers returned from the previous query and transmits the same
iterative query that was previously sent to a root server.
- The net domain server that is contacted returns the best information it has, which are the names and addresses of the internic.net servers and a TTL value.
- The local DNS server contacts one of the internic.net domain servers and makes the same query for the IP address for the Internet name, ftp.internic.net.
- An internic.net server returns the IP addresses of the Internet name, ftp.internic.net, along with a TTL value.
The local DNS server returns the requested address to the client system, and the client can proceed.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/451222/viewspace-606993/
,如需转载,请注明出处,否则将追究法律责任。