RFC-952(假设中第1点的最后一句)禁止使用单字符主机名,而我(在7年前的2002 年夏天)经历过一些服务拒绝使用单字符主机名的经历(因为这样的名称是(不符合标准)),但是我发现过去几年中使用了许多单字符主机名。单字符主机名现在有效吗?(如果是这样,正确的验证参考是什么?)
编辑(巩固从答案的一些信息):DNS的各个方面似乎在几个RFC的定义,其中包括1035,1123和2181。根据RFC-2181第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.
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].
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禁止单字符主机名。
There is a difference between 'valid' and 'it works'.
最终,我认为这是最合理的答案,尽管我非常感谢所有讨论。我得出的结论是,一个字符的主机名在技术上仍然无效,但是在这一点上可以普遍使用。(类似地,下划线是禁止的,但大部分情况下都起作用。)