头图

DNS series (1): Why does the updated DNS record not take effect?

If we want to access the content on another machine when we surf the Internet, we usually only need to directly enter a string of addresses, such as: www.upyun.com, and then we can accurately access the website we want to visit. But in fact this is just a character form of network identification that is convenient for us to remember. What really allows our machine to communicate with another machine is the IP address. It's just that IP addresses are very troublesome to input and remember, so the Domain Name System was born. So how does the domain name connect to the IP of that server? This is related to the domain name system DNS that we are going to talk about today.

What is DNS?

Because a meaningful name can represent the host's account, work nature, region and organization, etc., it is easy to remember and use. Therefore, users are more inclined to identify hosts by name, and DNS was developed for this need. DNS stands for Domain Name System. The system translates the domain name (example.com) into an actual IP address.

The logical structure of DNS is a hierarchical domain name tree. The root of the domain name tree is managed by the Internet Network Information Center (InterNIC), which is called "root domain". The root domain is represented by a period ".", but this is usually omitted. It should be noted that there are only 13 IPv4 root name servers in the world.

Below the root domain are top-level domains (TLDs), which are divided into country top-level domains (ccTLDs) and generic top-level domains (gTLDs). Country top-level domains use abbreviated country codes, such as "cn" for China. The generic top-level domain is our common com/net/org and so on.

Below the top-level domain is the second-level domain, which is the only name officially registered to organizations and individuals. For example, upyun in www.upyun.com is the domain name registered by Paiyun. Under the second-level domain, organizations can also divide sub-domains for use by various branches. However, the standard stipulates that the length of a domain name is usually no more than 63 characters, and can not exceed 255 characters at most.

Of course, DNS can not only point to IP addresses, but also supports other forms of records. Common forms of DNS records are:

  • A record: A record of the domain's IPv4 address.
  • AAAA record: A record of the domain's IPv6 address.
  • CNAME record: An alias that forwards one domain or subdomain to another without providing an IP address.
  • MX records: Direct mail to an email server.
  • TXT records: Enables administrators to store text comments in records.
  • NS records: Name servers that store DNS entries.

A distinctive domain name can allow users to "deeply imprint" the company's brand in their minds. While a domain name may be immutable, the addresses the records point to and the DNS servers used can change frequently based on demand. Sometimes we also encounter a situation where the address actually accessed is not updated after the DNS record is modified, which involves DNS propagation.

What is DNS propagation?

Generally, after we change the domain name resolution record or DNS service provider of the website, it takes a period of time for all servers in the world to adopt the new record value. This period may be a few hours or a few days. This transition period is DNS propagation.

DNS propagation varies depending on the load on the DNS server. The older the server, the longer it takes to update. Therefore, during the transition period, other providers may have used the new address, but some service providers of the old server may not have been updated. This is because the continuous query for new addresses will cause a high load, so the DNS server will not temporarily store the updated information in the cache, and only when all servers have updated this cache will the new address be synchronized everywhere.

In addition to server load, there are factors that affect DNS propagation.

Factors Affecting DNS Propagation

DNS zone and TTL value

DNS is divided into many different zones, which are part of the DNS namespace and are managed by specific organizations or administrators. A zone file is a plain text file stored on a DNS server that contains the actual representation of the zone, and all records for each domain within the zone.

We can set TTL for each DNS in the domain name zone file. TTL stands for "Time To Live" and is the period of time that the server caches DNS information. It can define settings for temporary caching, how long to store it, and when to update it. The TTL value is critical for DNS propagation, if the TTL value is 24 hours, it will take 1 day for the change to take effect. Of course, in order for the update to take effect faster, we can adjust the TTL value. However, this adjustment must be done before the update, because adjusting the TTL is also DNS propagation and takes a while to take effect. Also be careful not to set the DNS TTL to 0 as the number 0 is not defined in the standard and it may cause DNS information to be ignored or rejected.

If you use cloud DNS to modify the resolution record of a domain name, the final effective time depends on the cache refresh time of the DNS server of the local operator, which is generally equivalent to the TTL time when setting the resolution. For example, the TTL value in the parsing setting is 10 minutes. After the parsing is modified, it will take effect globally within 10 minutes.

If the DNS server is modified, the effective time depends on the TTL time of the domain name DNS server name in the local DNS cache. For example, the ".com" top-level domain is 48 hours, and the ".cn" is 24 hours. Because the TTL time of different top-level domain DNS servers is different, theoretically, it takes up to 48 hours to modify the global resolution of the domain name DNS server to take effect.

ISP (Internet Service Provider)

Another factor that affects the duration of DNS propagation is the Internet Service Provider (ISP) used. ISPs cache DNS data locally, and each request retrieves the data from the cache rather than the DNS server. The benefit of this approach is faster response, while also reducing the generation of data traffic. However, this may have an impact on DNS propagation. Also, some ISPs simply ignore the TTL setting and only update cache records every two to three days.

server location

The location of the server also affects DNS propagation. Changes to records can take effect at the nearest DNS server for a short period of time, but usually take longer to reach a server on the other side of the world. Because different servers need to notify each other of record changes one by one. And as mentioned in the second point, since some servers may only be updated at specific time intervals, it will take a long time for all updates to be completed.

DNS propagation time

How long does the actual DNS propagation take? Local servers are usually updated within minutes or hours. However, it can take a considerable amount of time for these changes to be made known to all servers around the world and to take effect, usually within 1-2 days is possible. And depending on the service provider's settings, it may take 72 hours for all updates to occur. Therefore, it is important to schedule DNS propagation in advance when records need to be changed or switched.

In some cases, DNS propagation can have an impact on website access, which cannot be completely avoided, but there are ways to minimize the duration. For example, before changing the DNS server, we can modify the TTL value in the resolution record and set it to a smaller value. After the TTL value is updated, modify the DNS server. However, even if it is not finished, it does not affect the modification of the domain name resolution records. Even if the DNS server is still old, the resolution records will be updated in real time and the website content will be up to date.

Of course, if after the resolution record is modified, it is found that the old record is still accessed after the TTL time, you can try to clear the local DNS cache. Or change it locally to public DNS (114.114.114.114/8.8.8.8) and try again.

DNS propagation check

If there is no tool to determine if DNS propagation of a website is complete. This can be confirmed by checking the local DNS for DNS propagation in several ways. For example, Windows, macOS, and Linux have nslookup installed by default, which displays the current DNS server resolution status. Dig tools are also a good option.

In addition to local queries, other external DNS checks need to be tested by choosing a random server and querying the DNS information there. Since the servers are spread all over the world, it's not 100% sure that DNS propagation has been done everywhere, but at least a rough estimate. For example, using Myssl's DNS detection tool ( https://myssl.com/dns_check.html#dns_check ), you can quickly find out the speed of domain name resolution and domain name DNS information under different networks in different regions.

After reading this, do you have an answer to the problem that the DNS modification does not take effect? DNS propagation is still a priority when making DNS server or Domain Name System related changes. Although the propagation time can be shortened with TTL, it still takes some time for every server in the world to be up-to-date due to some instability.

Recommended reading

What is walking index?

About the routing tree of GIN


云叔
-- 隐于云端,静闻天籁 --

又拍云是专注CDN、云存储、小程序开发方案、 短视频开发方案、DDoS高防等产品的国内知名企业级云服务商。

5.7k 声望
4.6k 粉丝
0 条评论
推荐阅读
一文读懂 Kubernetes 存储设计
在 Docker 的设计中,容器内的文件是临时存放的,并且随着容器的删除,容器内部的数据也会一同被清空。不过,我们可以通过在 docker run 启动容器时,使用 --volume/-v 参数来指定挂载卷,这样就能够将容器内部的...

云叔_又拍云阅读 322

封面图
JavaScript有用的代码片段和trick
平时工作过程中可以用到的实用代码集棉。判断对象否为空 {代码...} 浮点数取整 {代码...} 注意:前三种方法只适用于32个位整数,对于负数的处理上和Math.floor是不同的。 {代码...} 生成6位数字验证码 {代码...} ...

jenemy46阅读 5.8k评论 12

从零搭建 Node.js 企业级 Web 服务器(十五):总结与展望
总结截止到本章 “从零搭建 Node.js 企业级 Web 服务器” 主题共计 16 章内容就更新完毕了,回顾第零章曾写道:搭建一个 Node.js 企业级 Web 服务器并非难事,只是必须做好几个关键事项这几件必须做好的关键事项就...

乌柏木65阅读 6k评论 16

再也不学AJAX了!(二)使用AJAX ① XMLHttpRequest
「再也不学 AJAX 了」是一个以 AJAX 为主题的系列文章,希望读者通过阅读本系列文章,能够对 AJAX 技术有更加深入的认识和理解,从此能够再也不用专门学习 AJAX。本篇文章为该系列的第二篇,最近更新于 2023 年 1...

libinfs39阅读 6.3k评论 12

封面图
从零搭建 Node.js 企业级 Web 服务器(一):接口与分层
分层规范从本章起,正式进入企业级 Web 服务器核心内容。通常,一块完整的业务逻辑是由视图层、控制层、服务层、模型层共同定义与实现的,如下图:从上至下,抽象层次逐渐加深。从下至上,业务细节逐渐清晰。视图...

乌柏木42阅读 7.2k评论 6

CSS 绘制一只思否猫
欢迎关注我的公众号:前端侦探练习 CSS 有一个比较有趣的方式,就是发挥想象,绘制各式各样的图案,比如来绘制一只思否猫?思否猫,SegmentFault 思否的吉祥物,是一只独一无二、特立独行、热爱自由的(>^ω^&lt...

XboxYan42阅读 2.9k评论 14

封面图
从零搭建 Node.js 企业级 Web 服务器(二):校验
校验就是对输入条件的约束,避免无效的输入引起异常。Web 系统的用户输入主要为编辑与提交各类表单,一方面校验要做在编辑表单字段与提交的时候,另一方面接收表单的接口也要做足校验行为,通过前后端共同控制输...

乌柏木33阅读 6.1k评论 9

又拍云是专注CDN、云存储、小程序开发方案、 短视频开发方案、DDoS高防等产品的国内知名企业级云服务商。

5.7k 声望
4.6k 粉丝
宣传栏