加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

domain-name-system – 如何在DNS主机名中使用数字?

发布时间:2020-12-14 23:33:51 所属栏目:资源 来源:网络整理
导读:我想设置一个只包含数字的DNS记录,例如: www1 A 1.2.3.41 CNAME www1 但是,纯数似乎不起作用. 我知道一些在主机名中使用整数的网站,比如400.5432.somefax.com,所以我想也许我应该逃避这些数字? 编辑 看来BIND确实支持纯数字的标签: $dig @localhost 1.exa
我想设置一个只包含数字的DNS记录,例如:
www1                    A       1.2.3.4
1                       CNAME   www1

但是,纯数似乎不起作用.

我知道一些在主机名中使用整数的网站,比如400.5432.somefax.com,所以我想也许我应该逃避这些数字?

编辑

看来BIND确实支持纯数字的标签:

$dig @localhost 1.example.com
...
1.example.com.     43200  IN  CNAME  www1.example.com.
www1.example.com.  43200  IN  A      1.2.3.4
...

但是,当我使用谷歌DNS服务器(8.8.8.8)时,它失败了.

; <<>> DiG 9.7.3 <<>> 1.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY,status: NXDOMAIN,id: 20866
;; flags: qr rd ra; QUERY: 1,ANSWER: 0,AUTHORITY: 1,ADDITIONAL: 0

;; QUESTION SECTION:
;1.example.com.         IN  A

;; AUTHORITY SECTION:
example.com.        1205    IN  SOA root.example.com. admin.example.com. 5 3600 600 43200 3600

;; Query time: 112 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue May  3 19:09:39 2011
;; MSG SIZE  rcvd: 94

但是,Google DNS服务器应该没有数字标签的问题,因为它可以解析,例如,83592583.qzone.qq.com:

; <<>> DiG 9.7.3 <<>> 83592583.qzone.qq.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY,status: NOERROR,id: 18687
;; flags: qr rd ra; QUERY: 1,ANSWER: 4,AUTHORITY: 0,ADDITIONAL: 0

;; QUESTION SECTION:
;83592583.qzone.qq.com.     IN  A

;; ANSWER SECTION:
83592583.qzone.qq.com.  600 IN  CNAME   qq.com.edgesuite.net.
qq.com.edgesuite.net.   9439    IN  CNAME   a1574.b.akamai.net.
a1574.b.akamai.net. 18  IN  A   60.254.175.65
a1574.b.akamai.net. 18  IN  A   60.254.175.64

;; Query time: 328 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue May  3 19:12:10 2011
;; MSG SIZE  rcvd: 134

所以,BIND9没关系,谷歌DNS没关系,我的区域配置没问题,我可以挖掘@localhost 1.example.com,它给出了正确的答案.但我无法挖掘@ 8.8.8.8 1.example.com,(既不是8.8.4.4),现在我卡住了.

解决方法

记录常见DNS配置错误的RFC 1912规定:

Allowable characters in a label for a host name are only ASCII
letters,digits,and the `-‘ character. Labels may not be all
numbers,but may have a leading digit (e.g.,3com.com)
. Labels must
end and begin only with a letter or digit. See [RFC 1035] and [RFC
1123]. (Labels were initially restricted in [RFC 1035] to start with
a letter,and some older hosts still reportedly have problems with
the relaxation in [RFC 1123].) Note there are some Internet
hostnames which violate this rule (411.org,1776.com). The presence
of underscores in a label is allowed in [RFC 1033],except [RFC 1033]
is informational only and was not defining a standard. There is at
least one popular TCP/IP implementation which currently refuses to
talk to hosts named with underscores in them.

标签相当于您问题的主机名.

RFC1912是信息性的,不是设置标准.在信息RFC的方式中,一些DNS实现将其视为福音,因此不适用于所有数字.这是另一种说法,为了最大程度地兼容整个互联网,在主机名中至少放一个字母.

显然它可以工作(哎呀,RFC引用示例!),所以诀窍是说服你的DNS服务器允许它.为此,我将不得不推荐给其他用户.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读