domain-name-system – 单字母主机名是否有效?

前端之家收集整理的这篇文章主要介绍了domain-name-system – 单字母主机名是否有效?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
RFC-952(假设下第1点的最后一句)禁止使用单字符主机名,而且我有过一些服务拒绝使用单字符主机名的经验(超过7年前的夏天,2002年)(因为这些名称不是标准-compliant),但我在过去几年中看到过许多单字符主机名.单字符主机名现在有效吗? (如果是,那么适当的验证参考是什么?)

编辑(以整合答案中的一些信息):DNS的各个方面似乎在几个RFC中定义,包括1035,11232181.从RFC-2181 section 11开始:

Note however,that the varIoUs applications that make use of DNS data
can have restrictions imposed on what particular values are
acceptable in their environment.  For example,that any binary label
can have an MX record does not imply that any binary name can be used
as the host part of an e-mail address.
[ ... ]
See also [RFC1123] section 6.1.3.5.

RFC-1123 section 6.1.3.5

The DNS defines domain name Syntax very generally -- a
string of labels each containing up to 63 8-bit octets,separated by dots,and with a maximum total of 255
octets.  Particular applications of the DNS are
permitted to further constrain the Syntax of the domain
names they use,although the DNS deployment has led to
some applications allowing more general names.  In
particular,Section 2.1 of this document liberalizes
slightly the Syntax of a legal Internet host name that
was defined in RFC-952 [DNS:4].

RFC-1123 section 2.1

The Syntax of a legal Internet host name was specified in RFC-952
[DNS:4].  One aspect of host name Syntax is hereby changed: the
restriction on the first character is relaxed to allow either a
letter or a digit.  Host software MUST support this more liberal
Syntax.

最后,从最初引用,从RFC-952

1. A "name" (Net,Host,Gateway,or Domain name) is a text string up
to 24 characters drawn from the alphabet (A-Z),digits (0-9),minus
sign (-),and period (.).  Note that periods are only allowed when
they serve to delimit components of "domain style names". (See
RFC-921,"Domain Name System Implementation Schedule",for
background).  No blank or space characters are permitted as part of a
name. No distinction is made between upper and lower case.  The first
character must be an alpha character.  The last character must not be
a minus sign or period.
[ ... ]
Single character names or nicknames are not allowed.

正是从这个链条开始,我才开始说RFC-952禁止使用单字符主机名.

解决方法

“有效”和“有效”之间存在差异.如果主机名是单个字符(我之前的帖子不能承受),则完全有可能主机名不被视为有效.但是,相当多的系统都允许它们.一个主要系统,即微软的AD / DNS系统,有一个允许单个字符名称的遗留原因.

旧学校NetBIOS名称的长度为1到15个字符.此规范是独立于RFC952开发的,它基于一个名为lmhosts的不同文件,因此它可以工作.当微软从NetBEUI(实际上是NBF,NetBIOS帧协议)转移到TCP / IP(实际上是NBT)时,问题出现了,微软不得不允许通过TCP / IP网络进行命名解析. MS选择使用WINS服务器维护NetBIOS样式解析,从而绕过了对RFC952兼容主机的需求.

然后是Active Directory及其DNS依赖项.动态DNS是规则,因此客户端必须在DNS域中注册其ComputerName(其前15个字符也是其NetBIOS名称).由于MS允许单字符NetBIOS名称在DNS中注册,因此这与RFC952冲突.他们决定对他们的系统进行编码以允许这样做,因为这模仿了它在WINS时代总是如何工作.

BIND DNS还允许单字符主机名.但RFC2181几乎表明,应用程序需要审查自己的数据,而不是DNS.这使得我们拥有大量的单个字符主机名称的设备和软件,以及一些不允许它的RFC952严格的异常值.

猜你在找的HTML相关文章