AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1085780
Accepted
abc
abc
Asked: 2021-12-09 15:25:43 +0800 CST2021-12-09 15:25:43 +0800 CST 2021-12-09 15:25:43 +0800 CST

所有域在技术上都以“.”结尾吗?

  • 772

我的理解是 TLD 是根域的子域,用“.”表示。

所以“google.com”在更具体的术语中应该是“google.com.”。

在什么情况下您会看到以“.”结尾的域。像“google.com.”?我以前见过它,但当时并没有想到它。

domain-name-system subdomain domain
  • 2 2 个回答
  • 82 Views

2 个回答

  • Voted
  1. Best Answer
    vaizki
    2021-12-09T15:37:34+08:002021-12-09T15:37:34+08:00

    是的,完全限定域名以点结尾。如果域名不以点结尾,则它始终是相对的。操作系统、正在使用的应用程序、某些代理或其他名称解析元素可能会尝试搜索与根.域以外的其他名称相关的名称。例如,在办公室,很可能会在根之前搜索公司域。

    从理论上讲,您可以在任何地方使用完全限定的域名,并可能将 Internet 从一些 DNS 命中和您自己的几毫秒中拯救出来。实际上,世界充满了验证正则表达式等,它们可能会拒绝这样一个(完全有效的)FQDN。

    它们非常常见的一种特殊情况是配置名称服务器时,例如 CNAME 记录。名称服务器中的区域通常将自身作为“相对根”,因此要在其外部引用域名,必须使用以点结尾的完全限定名称。

    • 2
  2. Patrick Mevzek
    2021-12-09T19:47:03+08:002021-12-09T19:47:03+08:00

    所有域在技术上都以“.”结尾吗?

    是的,如果您查看与 DNS 相关的核心 RFC,因为那里的任何名称都以值 0 的结束字节传输,该字节编码根,也就是“表示”格式的结束点。

    请参阅RFC 1035的第 3.1.5 节:

    NAME 表示为一系列标签的域名,其中每个标签由一个长度八位字节和该八位字节数组成。域名以根的空标签的零长度八位字节结束。

    这也是为什么在使用dig或编写区域文件时,您会看到名称以最后一个点结尾以消除任何歧义。

    现在,一切都取决于上下文。在 URL 中,您在末尾不带点写主机名,它可以工作,因为它暗示它们是绝对的。

    您可能想查阅RFC 8499,它是现在与 DNS 术语相关的所有内容的标准参考。它是这样说的:

          The presentation format for names in the global DNS is a list
         of labels ordered by decreasing distance from the root, encoded
         as ASCII, with a "." character between each label.  In
         presentation format, a fully-qualified domain name includes the
         root label and the associated separator dot.  For example, in
         presentation format, a fully-qualified domain name with two
         non-root labels is always shown as "example.tld." instead of
         "example.tld".  [RFC1035] defines a method for showing octets
         that do not display in ASCII.
    
         The common display format is used in applications and free
         text.  It is the same as the presentation format, but showing
         the root label and the "." before it is optional and is rarely
         done.  For example, in common display format, a fully-qualified
         domain name with two non-root labels is usually shown as
         "example.tld" instead of "example.tld.".  Names in the common
         display format are normally written such that the
         directionality of the writing system presents labels by
         decreasing distance from the root (so, in both English and the
         C programming language the root or Top-Level Domain (TLD) label
         in the ordered list is rightmost; but in Arabic, it may be
         leftmost, depending on local conventions).
    

    然后,定义了 FQDN,并详细介绍了与上下文相关的真正问题:

     Fully-Qualified Domain Name (FQDN):  This is often just a clear way
      of saying the same thing as "domain name of a node", as outlined
      above.  However, the term is ambiguous.  Strictly speaking, a
      fully-qualified domain name would include every label, including
      the zero-length label of the root: such a name would be written
      "www.example.net." (note the terminating dot).  But, because every
      name eventually shares the common root, names are often written
      relative to the root (such as "www.example.net") and are still
      called "fully qualified".  This term first appeared in [RFC819].
      In this document, names are often written relative to the root.
    
      The need for the term "fully-qualified domain name" comes from the
      existence of partially qualified domain names, which are names
      where one or more of the last labels in the ordered list are
      omitted (for example, a domain name of "www" relative to
      "example.net" identifies "www.example.net").  Such relative names
      are understood only by context.
    

    至于:

    在什么情况下您会看到以“.”结尾的域。像“google.com.”?

    简单,做任何 DNS 查询:

    $ dig NS google.com +noall +ans
    google.com.     3h9m51s IN NS ns4.google.com.
    google.com.     3h9m51s IN NS ns2.google.com.
    google.com.     3h9m51s IN NS ns3.google.com.
    google.com.     3h9m51s IN NS ns1.google.com.
    

    google.com.请注意,如果我使用的是 DNS 客户端,结果将完全相同dig,因此期望所有名称都是绝对的(因此结束点是可选的)。

    您还可以在任何名称中添加点,因此具有类似https://www.google.com./. 对于 DNS 平面,它是相同的。所以对于IP和TCP也是如此。对于 TLS,如果实现中没有错误,它应该是相同的。在 HTTP/HTTPS 级别,适当的服务器可以工作,但请注意,您可能会因此而遇到错误(因此显示的页面可能不是正常页面,或者出现错误)。

    电子邮件地址和您使用名称的其他任何地方都是如此。

    如果您要质疑某些事情,是的,根据定义,只有一个根……至少在理论上是这样(请参阅RFC 2826 “IAB Technical Comment on the Unique DNS Root”)。每个网络(从本地家庭甚至完整状态)都可以定义本地根,并且其他协议确实定义了看起来在根的名称,但实际上并非如此(例如:eth或bit)。但此时你进入了政治舞台,而不是技术领域。

    • 2

相关问题

  • Solaris DNS

  • resolv.conf 在经过一段时间后被更改

  • 为什么有些网站的网址中没有“www”就无法显示?[关闭]

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve