单个 DNS 响应中可以容纳多少条 A 记录?

编程入门 行业动态 更新时间:2024-10-23 13:27:46
本文介绍了单个 DNS 响应中可以容纳多少条 A 记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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:

域名(有线格式)QTYPEQCLASS 各两个字节 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:

压缩指针的两个字节TYPECLASS 各两个字节TTL 的四个字节RDLENGTH 的两个字节A 记录数据本身的四个字节 two bytes for the compression pointer two bytes each for TYPE and CLASS four bytes for the TTL two bytes for the RDLENGTH four bytes for the A record data itself

即每个 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:关键词]

本文发布于:2023-03-26 22:46:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/670303.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:DNS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!