Domain Name Service( 二 )


DNS servers and their databasesFor any group of computers partaking of the DNS naming scheme there is likely to be a single definitive list of DNS names and associated IP addresses. The group of computers included in this list is called a zone. A zone could be a top level national domain or a university department. Within a zone DNS service for subsidiary zones may be delegated along with a subsidiary domain. The computer that maintains the master list for a zone is said to have authority for that zone and will be the primary name server for that zone, there will also be secondaries for that zone. When any process needs to determine an IP address given a DNS address it calls upon the local host to resolve the address. This can be done in a variety of ways Table lookup. On Unix hosts the table is called /etc/hosts The process communicates with a local name server process. This is commonly called named on a Unix system. named initially obtains information from /etc/hosts but also maintains a cache of recent requests.

It sends a message to a remote system that is identified from the information in the file /etc/resolv.conf. Finally if a network information system (NIS) is in use DNS service may be one of the facilities provided by the network information system. Most SUN systems work this way although the NIS master will use one or more of the techniques described above to build and maintain the master database. If a named process cannot resolve an address locally it will call upon higher authority. Ultimately it will attempt to contact the system that is authoritative for the zone in question, however, unless the information is cached or in the hosts local files then it will not know the address of the authoritative server. This problem is resolved by recursive resolution of requests, i.e. any DNS server will pass requests it cannot handle to a higher level server and so on until either the request can be handled (either by sending a message to the identified authoritative host) or until the root of the DNS name space is reached. There are eight servers that can serve requests at the root of the DNS name space, all servers should know their IP addresses so that DNS service can be offered even if there are no cached addresses and no local servers indicated by the /etc/resolv.conf file. The root servers will know the IP addresses of the servers for all the national DNS zones and the three letter zones.
Communication between serversThe message formats used for exchange of queries and responses between hosts and DNS servers is specified in RFC1035. Queries and responses can be transferred either via TCP or via UDP. There are "well-known" port numbers for DNS service using either protocol. The format of a DNS query and response is Bits 0-15 Bits 16-31 Identification flags number of questions number of answer RRs number of authority RRs number of additional RRs questions answers (RRs) authority (RRs) additional information RRs are Resource Records 【Domain Name Service】The 16 flag bits provide further information about the query QR bit. A single indicating a query (0) or a response (1)
opcode 4 bits whose value means Value Meaning 0 Standard Query 1 Inverse Query 2 Server status request
AA bit If set, this means that the server is authoritative for the domain in question.
TC bit If set this means that the reply size exceeded 512 bytes and only the first 512 bytes were actually returned. This will only be used if the response is being returend via UDP.
RD bit. If this bit is not set then recursion is denied. This means that if the responding server cannot resolve the query itself rather than passing it on to "higher authority" and returning the result it eventually receives, it will simply return a list of other servers to try.
RA bit.
If this bit is set by a responding server then that server is indicating that it can handle queries recusively. 3 unused bits. These must be zero.
4 rcode bits. This indicates the status Value Meaning 0 No error 1 Malformed Query 2 Server Failed 3 Name Does not Exist 4 Query type unsupported by server 5 Server refused to answer

推荐阅读