问题描述
DNS 响应的大小限制是多少?例如,单个 DNS 响应中可以存在多少个A"资源记录?DNS 响应仍应可缓存.
What are the size limits on DNS responses? For instance how many 'A' resource records can be present in a single DNS response? The DNS response should still be cache-able.
推荐答案
保证支持的最大 DNS 消息大小为 512 字节.
The largest guaranteed supported DNS message size is 512 bytes.
其中 12 个被标头用完(参见 RFC 1035 的 §4.1.1).
Of those, 12 are used up by the header (see §4.1.1 of RFC 1035).
问题部分接下来出现,但长度可变 - 具体来说是:
The Question Section appears next, but is of variable length - specifically it'll be:
域名(有线格式)QTYPE 和 QCLASS 各两个字节 the domain name (in wire format) two bytes each for QTYPE and QCLASS因此,您的域名越长,留给答案的空间就越小.
Hence the longer your domain name is, the less room you have left over for answers.
假设使用了标签压缩(第 4.1.4 节),每个 A
记录将需要:
Assuming that label compression is used (§4.1.4), each A
record will require:
即每个 A 记录 16 个字节(第 4.1.3 节).
i.e. 16 bytes for each A record (§4.1.3).
如果可能,您还应该在权威部分中包含您的 NS 记录.
You should if possible also include your NS records in the Authority Section.
考虑到所有这些,您可能会将大约 25 条记录压缩到一个响应中.
Given all that, you might squeeze around 25 records into one response.
这篇关于单个 DNS 响应中可以容纳多少条 A 记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论