域名管理系统 二级域名_域名系统简介

域名管理系统 二级域名

by Sumedh Nimkarde

由Sumedh Nimkarde

域名系统简介 (An introduction to the Domain Name System)

You all might have heard about or know about the Domain Name System (DNS) if you understand how the internet works or how computer networks work. If you aren’t familiar with DNS, I would recommend that you go and check out my previous blog post which is focused on computer networks here.

如果您了解互联网的工作方式或计算机网络的工作方式,那么您可能都听说过或知道域名系统(DNS)。 如果你不熟悉DNS,我建议你去看看它是专注于计算机网络我以前的博客文章在这里

Hostnames alone cannot tell us where the particular machine/hardware that we are trying to communicate with is located in the world. Hence, all communication is done with IP addresses.

仅主机名不能告诉我们我们试图与之通信的特定机器/硬件在世界上的何处。 因此,所有通信都是通过IP地址完成的。

Domain Name Servers are the devices that map the hostname to the IP addresses of the machine/hardware on which your services are running.

域名服务器是将主机名映射到运行您的服务的计算机/硬件的IP地址的设备。

In this post, I will be explaining in detail the types of DNS queries, types of DNS servers, and types of DNS records.

在这篇文章中,我将详细解释DNS查询的类型,DNS服务器的类型和DNS记录的类型。

DNS解析器 (DNS Resolver)

DNS Resolvers are the computers used by Internet Service Providers (ISPs) to perform lookups in their database for the particular hostname requested by the user. They then redirect that user to the mapped IP address. They play a vital role in DNS Resolution.

DNS解析器是Internet服务提供商(ISP)用来在其数据库中针对用户请求的特定主机名执行查找的计算机。 然后,他们将该用户重定向到映射的IP地址。 它们在DNS解析中起着至关重要的作用。

DNS Resolvers also cache the data. So for example, my websiteexample.com is currently hosted on a machine with the IP address 35.195.226.230 . So, the caches of the DNS Resolvers all over the world have mapped the following:

DNS解析器还会缓存数据。 因此,例如,我的网站example.com当前托管在IP地址为35.195.226.230 。 因此,全球DNS解析器的缓存已映射以下内容:

example.com -> 35.195.226.230

example.com &g t; 35.195.226. t; 35.195.226. 230

Consider, in the future, if I want to host my website on any another server across the world with an IP of, say, 35.192.247.235. The DNS caches of all the DNS Resolvers across the world will still have the old IP address for some time. This may lead to unavailability through conventional means of the website until the DNS propagation happens completely.

考虑一下,如果将来我想将我的网站托管在IP为35.192.247.235的全球任何其他服务器上。 全球所有DNS解析器的DNS缓存在一段时间内仍将具有旧IP地址。 这可能会导致通过网站的常规方式无法使用,直到DNS传播完全发生为止。

The record in the DNS Resolver cache remains there for some time, which is called time to live (TTL for short).

DNS解析器缓存中的记录会保留一段时间,这称为生存时间(简称TTL)。

This is the time a record is cached in the DNS Resolver. This can be set in the registrar’s dashboard from where you have purchased the domain.

这是一条记录在DNS解析器中缓存的时间。 可以在您购买域名的注册商控制台中进行设置。

Note: from now on, I will refer to the DNS Resolver as Resolver only in this blog post.

注意:从现在开始,我仅在此博客文章中将DNS解析器称为解析器。

DNS服务器类型 (Types of DNS servers)

根DNS服务器 (Root DNS server)

The Root DNS servers are the ones who have the addresses of all the TLD domain servers. A request first encounters the Root DNS servers while on its journey to obtain the IP address from the hostname.

根DNS服务器是具有所有TLD域服务器地址的服务器。 在从主机名获取IP地址的过程中,请求首先遇到根DNS服务器。

There are 13 root domain name servers across the world as of 2016. This does not mean that there are only 13 machines handling the load of the requests coming from all over the world — there are multiple servers at ground level handling the load.

截至2016年,全球共有13台根域名服务器。这并不意味着只有13台计算机可以处理来自世界各地的请求负载-地面上有多台服务器可以处理负载。

Different organizations manage the Root DNS servers:

不同的组织管理根DNS服务器:

TLD域服务器 (TLD domain server)

These are the ones classified according to the Top-Level Domain. They are usually the next ones which the iterative query hits after the Root DNS server. They store the TLD specific records for the hostname.

这些是根据顶级域分类的。 它们通常是根DNS服务器之后迭代查询命中的下一个查询。 它们存储主机名的TLD特定记录。

Let’s say if we are requesting an IP address of medium.com , then the TLD domain servers for “.com” TLD are queried. The TLD domain servers return the address of the Authoritative DNS servers to the Resolver.

假设如果我们请求IP地址为medium.com ,那么将查询“ .com” TLD的TLD域服务器。 TLD域服务器将权威DNS服务器的地址返回到解析器。

Now, the question arises: how does the TLD name server know the address of the Authoritative Name server? The answer is simple: when you purchase any domain with the registrars like Godaddy or Namecheap, the registrars also communicate the domains to the TLD name server. So it is able to contact the Authoritative Name servers.

现在,出现了一个问题:TLD名称服务器如何知道权威名称服务器的地址? 答案很简单:当您通过Godaddy或Namecheap之类的注册商购买任何域名时,注册商还将这些域名传达给TLD名称服务器。 因此,它可以联系权威名称服务器。

Nowadays, some of the registrars provide the ability to use third party Authoritative Name servers. As shown in the above figure, you can set up the Authoritative Nameservers in the registrar’s dashboard.

如今,某些注册商可以使用第三方权威名称服务器。 如上图所示,您可以在注册商的仪表板中设置权威名称服务器。

权威DNS服务器 (Authoritative DNS server)

These are queried iteratively in the end by the Resolver. They store the actual records for type A, NS, CNAME, TXT, etc.

最后,解析程序会反复查询这些内容。 它们存储类型A,NS,CNAME,TXT等的实际记录。

Thus, they return the IP address of the hostname if available. If it is not available even in the Authoritative DNS server, then they throw an error with the particular message and the process of searching IP addresses across the Nameserver ends.

因此,它们将返回主机名的IP地址(如果可用)。 如果即使在权威DNS服务器中也不可用,则他们会向特定消息抛出错误,并且跨名称服务器搜索IP地址的过程结束。

DNS查询类型 (Types of DNS queries)

There are three types of DNS queries:

DNS查询分为三种:

Recursive: Recursive queries are made by users to the Resolver. It is actually the first query made while doing any DNS lookup.

递归 :用户对解析器进行递归查询。 它实际上是在进行任何DNS查找时进行的第一个查询。

The Resolvers can be your ISP or your network admin, but usually, it is the ISP in almost all cases.

解析程序可以是您的ISP或您的网络管理员,但是通常,在几乎所有情况下,它都是ISP。

Non-recursive: in non-recursive queries, the Resolver knows the answer and responds immediately without making any further queries to any other name servers. This happens because the local DNS server has the IP address stored in its local cache or it just queries the Authoritative name servers directly. They happen to definitely hold the record and this eventually avoids the recursive queries.

非递归:在非递归查询中,解析程序知道答案并立即响应,而无需对任何其他名称服务器进行任何进一步查询。 发生这种情况是因为本地DNS服务器在其本地缓存中存储了IP地址,或者仅直接查询了权威名称服务器。 它们恰好保持记录,这最终避免了递归查询。

Iterative: Iterative queries happen when the Resolver cannot return the results since they may not have cached it. So, it makes a request to the Root DNS server. And the Root DNS servers know where to find the particular TLD domain server.

迭代 :迭代查询发生在解析器无法返回结果(因为它们可能没有缓存结果)时。 因此,它向根DNS服务器发出请求。 根DNS服务器知道在哪里可以找到特定的TLD域服务器。

So, for example, if we are trying to obtain the IP address for say medium.com , then the Root domain server will have the address of the .com TLD server stored in it and will then send it back to the Resolver. The Resolver then asks the TLD server for the IP address. The TLD domain server may not know it, but it knows the address of the Authoritative DNS server for medium.com .

因此,例如,如果我们尝试获取medium.com的IP地址,则根域服务器将在其中存储.com TLD服务器的地址,然后将其发送回解析器。 然后,解析程序会向TLD服务器询问IP地址。 TLD域服务器可能不知道,但它知道medium.com的权威DNS服务器的medium.com

Okay, enough of the theory. Let’s understand it by a flow diagram:

好的,理论足够了。 让我们通过流程图来了解它:

Let’s break down the above diagram in steps:

让我们按步骤分解上图:

  1. The user makes a request to the Resolver with the hostname for which it wants the IP address. This is a recursive query.

    用户使用需要其IP地址的主机名向解析器发出请求。 这是一个递归查询。
  2. The Resolver does a lookup in its cache to see if it is present in it.

    解析程序在其缓存中进行查找以查看其是否存在。
  3. If it is, it returns it back to the user.

    如果是,则将其返回给用户。
  4. If it does not have it cached, it makes an iterative request to the Root DNS servers that are present globally. As of 2016, there are 13 Root DNS servers named from A — M. Now, the Root DNS server looks up for the TLD of the requested domain. For example, if the hostname is medium.com , then the TLD becomes “.com” and the Root DNS server has the entry for “.com” domain servers and it returns the results back to the Resolver. The Resolver must have the addresses of all the Root domain name servers. If it doesn’t, the DNS lookup may fail in the first place.

    如果没有缓存它,它将向全局存在的Root DNS服务器发出迭代请求。 截至2016年,有13个以A — M命名的Root DNS服务器。现在,Root DNS服务器将查找所请求域的TLD。 例如,如果主机名是medium.com ,则TLD变为“ .com”,并且根DNS服务器具有“ .com”域服务器的条目,并将结果返回给解析器。 解析程序必须具有所有根域名服务器的地址。 如果不是这样,DNS查找可能首先会失败。

  5. Now, the Resolver again makes an iterative request to the TLD domain server asking for the IP address of the domain. The TLD domain server then returns back the address of the Authoritative server for the requested domain.

    现在,解析器再次向TLD域服务器发出迭代请求,要求该域的IP地址。 然后,TLD域服务器将返回所请求域的权威服务器的地址。
  6. As of now, I believe, you may understand what are Authoritative DNS servers. They contain the actual records where the hostname is mapped to the IP address and hence the IP address is returned back to the Resolver (which in turn returns it back to the user).

    我相信,到目前为止,您可能已经了解什么是权威DNS服务器。 它们包含实际记录,在这些记录中,主机名已映射到IP地址,因此IP地址被返回给解析器(解析器又将其返回给用户)。
  7. If no matching record is found in the Authoritative Name servers, then an error with a message saying “DNS_PROBE_FINISHED_NXDOMAIN” is thrown indicating there is no record for the requested hostname.

    如果在“权威名称”服务器中找不到匹配的记录,则会引发一条错误消息,提示“ DNS_PROBE_FINISHED_NXDOMAIN”,表明没有所请求主机名的记录。
  8. In all the Nameservers the request passes through, the results for the requested hostname are cached so that when any other user requests the same domain, the record will already be present in the DNS cache.

    在请求经过的所有名称服务器中,将缓存所请求主机名的结果,以便当任何其他用户请求同一域时,该记录将已经存在于DNS缓存中。
  9. All in all, it takes at the max four queries to perform the DNS lookup. But, it hardly takes a few milliseconds to perform the lookup.

    总而言之,最多需要四个查询来执行DNS查找。 但是,几乎不需要花费几毫秒的时间来执行查找。
DNS传播的概念 (The concept of DNS Propagation)

Consider, you have your website hosted with some provider like Digital Ocean on any machine with IP “x”, and you want to shift the website hosting to any other machine with different IP address say “y”. You will have to change the IP address in the Authoritative records so that traffic navigates to the new IP address.

考虑一下,您的网站托管在数字IP为“ x”的任何计算机上,由Digital Ocean等提供商托管,并且您希望将网站托管转移到其他IP地址为“ y”的计算机。 您将必须在权威记录中更改IP地址,以便流量导航到新的IP地址。

Even if you update the records in your registrar’s/ name server’s dashboard, it takes some time to reflect in all the Resolvers’ caches in the world. DNS propagation can take 24–72 hours, but usually it happens sooner than that since most ISPs keep the TTL low.

即使您更新了注册服务商/名称服务器的仪表板中的记录,也需要花费一些时间来反映世界上所有解析程序的缓存。 DNS传播可能需要24到72个小时,但通常会比大多数情况更早发生,因为大多数ISP将TTL保持在较低水平。

And that’s it!

就是这样!

Thanks for reading the article. If you have any questions, please feel free to ask them in the comments below and share this post with whomever you want.

感谢您阅读本文。 如果您有任何疑问,请随时在下面的评论中提问,并与任何人分享。

See you in the next one. Have a great time. Thank you.

下一个见。 玩得开心。 谢谢。

You can check out my other article on Computer Networks which explains them in detail:

您可以查看我在《计算机网络》上的另一篇文章,其中详细介绍了它们:

What computer networks are and how to actually understand themWhether you are new to the world of development, or have been building things for a long time — or even if you’re a…medium.freecodecamp.org

什么是计算机网络以及如何真正理解它们? 无论您是开发世界的新手,还是已经构建了很长时间的计算机-甚至您是一个中等水平的人。

If you like my work, you can buy me a coffee at:

如果您喜欢我的工作,可以在以下位置给我买咖啡:

Buy Sumedh Nimkarde a Coffee - BuyMeACoffee.comHello, I am Sumedh and my work is to build, break and rebuild things.buymeacoffee.com

买Sumedh Nimkarde喝咖啡-BuyMeACoffee.com 您好,我是Sumedh,我的工作是建造,破坏和重建事物。 buymeacoffee.com

Feel free to reach out to me on Twitter.

随时通过Twitter与我联系。

翻译自: https://www.freecodecamp.org/news/understanding-the-domain-name-servers-46c6bcf9afa3/

域名管理系统 二级域名

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值