Chinaunix首页 | 论坛 | 博客
  • 博客访问: 423070
  • 博文数量: 68
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 671
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-11 13:36
文章分类

全部博文(68)

文章存档

2010年(14)

2009年(7)

2008年(47)

我的朋友

分类: 系统运维

2009-10-16 11:50:23

今天工作中遇到一个问题, 客户报告说测试dns时如果输入的域名长度为128位字符, 就会发出错误的dns包,
抓包看了看还真是, 倒腾了半天, 看代码什么的都没有问题, 可是wireshark抓到得就是错误的包, 估计是
dns长度有限制, 可是不知道具体的, 于是问google, 一大堆结果说什么的都有, 有的说长度不能超过20个
字符, 有的说2-46, 还有的说国际域名长度不能超过67个字符, 结果测试下来都不对, 没办法, 只能找rfc,
结果一看就明白了(以后要坚定了, 这种问题直接找rfc才最有效), rfc1035中有说明, 为了和现有的域名兼
用, 域名应该满足由各个lables以点号分隔, 各lable长度应该在63个字符之内, 而且总长度应该不超过255.
简单的说, 以下格式中:
***.***.com
***.***.cn
***.***.org
等等的域名中, ***的长度应该不超过63, 而总长度不应该超过255.

--------附上 rfc1035 [page 10]中的相关内容:
3. DOMAIN NAME SPACE AND RR DEFINITIONS

3.1. Name space definitions

Domain names in messages are expressed in terms of a sequence of labels.
Each label is represented as a one octet length field followed by that
number of octets.  Since every domain name ends with the null label of
the root, a domain name is terminated by a length byte of zero.  The
high order two bits of every length octet must be zero, and the
remaining six bits of the length field limit the label to 63 octets or
less.

To simplify implementations, the total length of a domain name (i.e.,
label octets and label length octets) is restricted to 255 octets or
less.

Although labels can contain any 8 bit values in octets that make up a
label, it is strongly recommended that labels follow the preferred
syntax described elsewhere in this memo, which is compatible with
existing host naming conventions.  Name servers and resolvers must
compare labels in a case-insensitive manner (i.e., A=a), assuming ASCII
with zero parity.  Non-alphabetic codes must match exactly.
阅读(4436) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~