一个DNS响应中可以容纳多少条A记录? [英] How many A records can fit in a single DNS response?

查看:54
本文介绍了一个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 ).

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:

  • 两个字节用于压缩指针
  • TYPE 和 CLASS
  • 分别为两个字节
  • TTL的四个字节
  • 两个字节,用于 RDLENGTH
  • A记录数据本身四个字节

即每个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆