linux关闭dns迭代查询,DNS查询和响应过程递归和迭代的使用
需要了解DNS查詢(xún)過(guò)程的遞歸和迭代的機(jī)制,找到了RFC的相關(guān)章節(jié),
對(duì)這個(gè)進(jìn)行了簡(jiǎn)單的翻譯(水平有限),可以留下來(lái)做個(gè)參考。
RFC 1034
4.3.1. Queries and responses(查詢(xún)和響應(yīng))
The principal activity of name servers is to answer standard queries. Both
the query and its response are carried in a standard message format which is
described in [RFC-1035]. The query contains a QTYPE, QCLASS, and QNAME, which
describe the types and classes of desired information and the name of interest.
域名服務(wù)器的首要任務(wù)是響應(yīng)標(biāo)準(zhǔn)查詢(xún)。查詢(xún)和響應(yīng)報(bào)文都有標(biāo)準(zhǔn)的格式(參考RFC1035)。一個(gè)查詢(xún)會(huì)包括描述查詢(xún)類(lèi)型的QTYPE,查詢(xún)類(lèi)的QCLASS,以及查詢(xún)名稱(chēng)QNAME.
The way that the name server answers the query depends upon whether it is
operating in recursive mode or not:
名稱(chēng)服務(wù)器處理查詢(xún)信息的方法依賴(lài)于他是否支持遞歸查詢(xún)模式:
The simplest
mode for the server is non-recursive, since it can answer queries using
only local information: the response contains an error, the answer, or a
referral to some other server "closer" to the answer. All name
servers must implement non-recursive queries.
對(duì)于服務(wù)器而言,最簡(jiǎn)單的查詢(xún)模式是非遞歸模式(迭代查詢(xún)),因?yàn)檫@樣可以?xún)H僅使用本地資源信息就可以完成響應(yīng):響應(yīng)報(bào)文可以是返回出錯(cuò)信息,或者查詢(xún)客戶(hù)下一步可以去找的“最近”的服務(wù)器。所有的服務(wù)器都必須實(shí)現(xiàn)迭代查詢(xún)。
The simplest
mode for the client is recursive, since in this mode the name server acts
in the role of a resolver and returns either an error or the answer, but
never referrals. This service is optional in a name server, and the name
server may also choose to restrict the clients which can use recursive
mode.
對(duì)于客戶(hù)端而言最簡(jiǎn)單的查詢(xún)模式是遞歸查詢(xún),因?yàn)檫@種模式下名稱(chēng)服務(wù)器充當(dāng)了一個(gè)查詢(xún)者的角色,會(huì)返回給客戶(hù)出錯(cuò)信息或者最終的查詢(xún)結(jié)果,但是從來(lái)不會(huì)返回下一步客戶(hù)應(yīng)該去找的服務(wù)器。這種遞歸查詢(xún)的模式對(duì)于名稱(chēng)服務(wù)器而言是可選的,并且名稱(chēng)服務(wù)器可以設(shè)置禁止客戶(hù)端使用遞歸查詢(xún)模式。
Recursive service is helpful in several situations:
遞歸查詢(xún)服務(wù)在以下情況下是很有用的:
a relatively
simple requester that lacks the ability to use anything other than a
direct answer to the question.
一個(gè)功能相對(duì)簡(jiǎn)單的查詢(xún)客戶(hù),他只能處理最終的查詢(xún)結(jié)果。
a request
that needs to cross protocol or other boundaries and can be sent to a
server which can act as intermediary.
一個(gè)發(fā)送給中轉(zhuǎn)服務(wù)器的需要跨網(wǎng)際,或者跨協(xié)議的查詢(xún)請(qǐng)求。
a network
where we want to concentrate the cache rather than having a separate cache
for each client.
當(dāng)我們需要將cache集中起來(lái)而不是將cache分散到其他客戶(hù)端
Non-recursive service is appropriate if the requester is capable of
pursuing referrals and interested in information which will aid future
requests.
當(dāng)請(qǐng)求者的目標(biāo)是得到下一個(gè)可以訪問(wèn)的服務(wù)器時(shí)使用非遞歸(迭代)服務(wù)是合適的。
The use of recursive mode is limited to cases where both the client and
the name server agree to its use. The agreement is negotiated through the use
of two bits in query and response messages:
遞歸服務(wù)只能在客戶(hù)端請(qǐng)求使用遞歸服務(wù)并且服務(wù)器同意提供相應(yīng)服務(wù)的情況下。這種協(xié)議是使用查詢(xún)和響應(yīng)報(bào)文中的兩位來(lái)進(jìn)行協(xié)商的。
The recursion
available, or RA bit, is set or cleared by a name server in all responses.
The bit is true if the name server is willing to provide recursive service
for the client, regardless of whether the client requested recursive
service. That is, RA signals availability rather than use.
域名服務(wù)器通過(guò)在所有的響應(yīng)報(bào)文中設(shè)置或清除RA位來(lái)表明是否支持遞歸。
Queries
contain a bit called recursion desired or RD. This bit specifies specifies
whether the requester wants recursive service for this query. Clients may
request recursive service from any name server, though they should depend
upon receiving it only from servers which have previously sent an RA, or
servers which have agreed to provide service through private agreement or
some other means outside of the DNS protocol.
查詢(xún)報(bào)文中包含了一位(RD)用來(lái)表明請(qǐng)求遞歸。RD位用來(lái)表明查詢(xún)客戶(hù)是否請(qǐng)求遞歸服務(wù)??蛻?hù)端有可能向任何域名服務(wù)器發(fā)送請(qǐng)求遞歸服務(wù)的查詢(xún)報(bào)文,盡管他們是建立在收到服務(wù)器端預(yù)先發(fā)送過(guò)來(lái)的RA位的信息,或者服務(wù)器端已經(jīng)同意通過(guò)私下協(xié)商來(lái)提供服務(wù),或者其他在DNS服務(wù)協(xié)議之外的情況。
The recursive mode occurs when a query with RD set arrives at a server
which is willing to provide recursive service; the client can verify that
recursive mode was used by checking that both RA and RD are set in the reply.
Note that the name server should never perform recursive service unless asked
via RD, since this interferes with trouble shooting of name servers and their
databases.
遞歸模式出現(xiàn)在設(shè)置了RD位的查詢(xún)請(qǐng)求到達(dá)了一個(gè)可以提供遞歸服務(wù)的服務(wù)器上,客戶(hù)端可以通過(guò)查看響應(yīng)報(bào)文中的RA和RD位來(lái)確定是否使用了遞歸模式。注意:名稱(chēng)服務(wù)器永遠(yuǎn)不會(huì)主動(dòng)提供遞歸查詢(xún)模式,除非請(qǐng)求報(bào)文中設(shè)置了RD位,因?yàn)檫@樣會(huì)干擾到服務(wù)器的指向和他們的數(shù)據(jù)庫(kù)。
If recursive service is requested and available, the recursive response to
a query will be one of the following:
如果遞歸請(qǐng)求被成功響應(yīng),返回給查詢(xún)的遞歸結(jié)果會(huì)是以下幾種情況:
The answer to
the query, possibly preface by one or more CNAME RRs that specify aliases
encountered on the way to an answer.
針對(duì)查詢(xún)的回答,可能是在查詢(xún)過(guò)程中遇到的由別名所標(biāo)識(shí)的CNAME資源記錄。
A name error
indicating that the name does not exist. This may include CNAME RRs that
indicate that the original query name was an alias for a name which does
not exist.
查詢(xún)域名不存在的錯(cuò)誤。這個(gè)有可能是包含在CNAME記錄中的結(jié)果指明查詢(xún)的原始域名是一個(gè)指向不明確的別名。
A temporary
error indication.
一個(gè)臨時(shí)的錯(cuò)誤指向。
If recursive service is not requested or is not available, the non-
recursive response will be one of the following:
如果沒(méi)有請(qǐng)求遞歸服務(wù)或者遞歸服務(wù)不可用,迭代響應(yīng)會(huì)是以下幾種情況:
An
authoritative name error indicating that the name does not exist.
一個(gè)權(quán)威域名錯(cuò)誤,指出當(dāng)前查詢(xún)的名字不存在。
A temporary
error indication.
一個(gè)臨時(shí)的錯(cuò)誤指向。
Some
combination of:
下面幾種情況的組合:
RRs that
answer the question, together with an indication whether the data comes
from a zone or is cached.
回答資源記錄集,指明這個(gè)結(jié)果是來(lái)自緩存還是區(qū)域文件。
A referral
to name servers which have zones which are closer ancestors to the name
than the server sending the reply.
一個(gè)授權(quán)域名服務(wù)器的指向。
RRs that the
name server thinks will prove useful to the requester.
名稱(chēng)服務(wù)器認(rèn)為會(huì)提供給查詢(xún)客戶(hù)有用信息的資源記錄。
結(jié)論:何時(shí)使用遞歸何時(shí)使用迭代
使用迭代:
1.根域名服務(wù)器或者流量較大的域名服務(wù)器使用迭代查詢(xún),以減輕服務(wù)器的壓力。
2.服務(wù)器被配置為不使用遞歸的情況。
使用遞歸:
1.查詢(xún)報(bào)文中RD位設(shè)置為1,同時(shí)服務(wù)器支持遞歸,也就是響應(yīng)報(bào)文中RA
設(shè)置為1。
2.需要將cache集中起來(lái)的時(shí)候。
總結(jié)
以上是生活随笔為你收集整理的linux关闭dns迭代查询,DNS查询和响应过程递归和迭代的使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 启动系统检测不到硬盘怎么办 系统无法检测
- 下一篇: 进去bios不显示u盘怎么办 如何解决B