RFC series agreement--rfc1035--DOMAIN NAMES-IMPLEMENTATION AND SPECIFICATION

1 Introduction

1.1 Overview

The goal of a domain name is to provide a mechanism for naming resources so that the name can be used in different hosts, networks, protocol series, internet, and management organizations.

1.2 General layout

A host can participate in the domain name system in many ways, depending on whether the host runs a program that retrieves information from the domain system, a name server that answers queries from other hosts, or various combinations of these two functions. The simplest and probably the most typical configuration is as follows:

user queries
user responses
queries
responses
cache additions
references
User Program
Resolver
Foreign Name Server
cache

The user program interacts with the domain name space through the resolver; the format of user queries and user responses is specific to the host and its operating system. User queries are usually operating system calls, and the resolver and its cache will be part of the host operating system. A host with less capability can choose to implement the resolver as a subroutine to link with each program that needs its services. The resolver answers the user's query by querying the information obtained from the external name server and the local cache.

2. Domain name space and RR definition

2.1 Namespace definition

The domain name in the message is represented by a series of tags, and the name server and resolver must compare tags in a case-insensitive manner.

2.2 RR definition

2.2.1 Format

All RRs have the same top-level format, as shown below:

name definition
NAME Owner name, that is, the name of the node to which this resource record belongs
TYPE RR type
CLASS RR category
TTL Specify the time interval for caching resource records before querying the information source again. A value of zero is interpreted as RR can only be used for ongoing transactions and should not be cached
RDLENGTH Specify the length of the RDATA field
RDATA The format of this information varies according to the type and class of the resource record

2.2.2 TYPE value

The type field is used for resource records. Note that these types are a subset of QTYPEs.

TYPE value meaning
A 1 a host address
NS 2 an authoritative name server
MD 3 a mail destination (Obsolete - use MX)
MF 4 a mail forwarder (Obsolete - use MX)
CNAME 5 the canonical name for an alias
SOA 6 marks the start of a zone of authority
MB 7 a mailbox domain name (EXPERIMENTAL)
MG 8 a mail group member (EXPERIMENTAL)
MR 9 a mail rename domain name (EXPERIMENTAL)
NULL 10 a null RR (EXPERIMENTAL)
WKS 11 a well known service description
PTR 12 a domain name pointer
HINFO 13 host information
MINFO 14 mailbox or mail list information
MX 15 mail exchange
TXT 16 text strings

2.2.3 QTYPE value

The QTYPE field appears in the question part of the query. QTYPE is a superset of TYPE, so all types are valid QTYPEs. In addition, the following QTYPEs are defined:

QTYPE value meaning
AXFR 252 A request for a transfer of an entire zone
MAILB 253 A request for mailbox-related records (MB, MG or MR)
MAILA 254 A request for mail agent RRs (Obsolete - see MX)
* 255 A request for all records

2.2.4 CLASS value

The class field appears in the resource record. The following class mnemonics and values ​​are defined:

CLASS value meaning
IN 1 the Internet
CS 2 the CSNET class (Obsolete - used only for examples in some obsolete RFCs)
CH 3 the CHAOS class
HS 4 Hesiod [Dyer 87]

2.2.5 QCLASS值

QCLASS字段出现在查询的问题部分。QCLASS值是类值的超集;每个类都是一个有效的QCLASS。除了类值之外,还定义了以下QCLASS:

QCLASS 含义
* 255 any class

3.消息

3.1 格式

域名协议内的所有通信都以一种称为消息的单一格式进行。消息的顶层格式分为5个部分(有些部分在某些情况下是空的),如下所示:

名称 定义
Header 包含Transaction ID和Flags
Questions 关于名称服务器的问题
Answer RRs RRs回答问题
Authority RRs RRs认证
Additional RRs RRs额外信息

3.1.1 Header格式

名称 定义
ID 由程序分配的用于生成任何类型查询的16位标识符。此标识符复制相应的应答,请求者可以使用它来匹配未完成查询的应答。
QR 指定此消息是query (0)还是response (1)
OPCODE 用于指定此消息中的查询类型。该值由查询发起者设置并复制到响应中。0代表是一个标准查询
AA Authoritative Answer,此位在响应中有效,并指定响应名称服务器是问题部分中域名的认证。
TC TrunCation,指定此消息由于长度大于传输通道上允许的长度而被截断。
RD Recursion Desired,这个位可以在查询中设置并复制到响应中。如果设置了RD,它将指示名称服务器递归地跟踪查询。
RA Recursion Available,在响应中设置或清除的,它表示名称服务器中是否提供递归查询支持。
Z 留作将来使用。所有查询和响应必须为零。
RCODE Response code
QDCOUNT 用于指定问题部分中的条目数
ANCOUNT 用于指定答案部分中的资源记录数
NSCOUNT 用于指定权限记录部分中的名称服务器资源记录的数量
ARCOUNT 用于指定附加记录部分中的资源记录数

3.1.1.1 RCODE格式

定义
0 No error condition
1 Format error
2 Server failure
3 Name Error
4 Not Implemented
5 Refused
6-15 Reserved for future use

温馨提示:
以上文章描述如有不清晰之处,欢迎在评论区评论,如有时间,会第一时间回复,谢谢!

Guess you like

Origin blog.csdn.net/qq_20677327/article/details/106994017