我最近更改了一个网站的NS记录,当我发现使用https://toolbox.googleapps.com/apps/dig/#NS/这样的在线工具时,我可以看到它指向了正确的位置。即使我的手机在同一个wifi网络上--它会转到正确的网站,但在我的Ubuntu20.04上,它仍然会转到以前的站点,并且没有正确地指向新的站点。
在过去,我使用以下命令清除缓存,但这不再有效:
sudo /etc/init.d/nscd restart
我已经找到了一些类似的帖子,并尝试了许多答案或评论中的解决方案,但到目前为止对我没有任何作用。
这是我在3~4小时前更改的问题域的响应:
nslookup the-domain-name.org
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: the-domain-name.org
Address: xx.xx.xx.xx (INCORRECT_IP, points to the DNS provider)
Name: the-domain-name.org
Address: xx.xx.xx.xx (I am not sure if this IP is correct or not)
当我查看/etc/resolv.conf
文件内部时,它有以下内容:
GNU nano 4.8 /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0 trust-ad
search local
如何解决这个问题,以及刷新/刷新缓存的正确方法是什么?有人刚刚说到谷歌的DNS,怎么做呢?
编辑:更新,
我不得不将另一个域移到新的IP上,同样的问题再次发生。我尝试了这篇文章中的所有内容,但没有一篇对我有用:https://www.linuxuprising.com/2019/07/how-to-flush-dns-cache-on-linux-for.html
摘要:
挖掘-域A<显示不正确(旧的) IP>
挖掘-域A @8.8.8.8 <显示正确的(新) IP>
查找-域<显示不正确的(旧) address>
查找-域8.8.8.8 <显示正确的(新) address>
在任何浏览器中,chrome,Firefox,Brave,我都能看到老网站。
发布于 2021-03-05 22:38:22
resolvectl flush-caches
它可以取决于您是在使用systemd-network
还是network-manager
。看起来您的resolv.conf
是指向127.0.0.53
的,它是systemd-resolved
绑定到的回送地址。它维护自己的缓存,可以使用resolvectl
进行控制。使用systemd-resolved
是20.04中的默认设置(如果使用systemd-networkd
),但不是以前的LTS版本。
上游DNS服务器也可以缓存结果。如果希望具体查询DNS服务器,则可以使用命令nslookup the-domain-name.org the-dns-server
或dig the-domain-name.org @the-dns-server
。例如,要查询谷歌流行的quad8服务器,这些命令中的任何一个都能工作。
nslookup example.com 8.8.8.8
dig example.com @8.8.8.8
https://askubuntu.com/questions/1321456
复制相似问题