大网数据广告活动
服务器运维问答

Getting inconsistent results from dig

· 52CE 我爱测

I am trying to use dig, the bash command in Ubuntu 18.04LTS, to fetch all the txt records from a domain called zhihu.com , and it gives me inconsistent results. The command I use is: dig @8.8.8.8 SOA +short -t txt zhihu.com This …

问题原文

原帖链接 · shoorlyne · CC BY-SA 4.0

I am trying to use dig, the bash command in Ubuntu 18.04LTS, to fetch all the txt records from a domain called zhihu.com, and it gives me inconsistent results.

The command I use is:

dig @8.8.8.8 SOA +short -t txt zhihu.com

This result looks good to me:

root@mx:/var/www/html/server# dig @8.8.8.8 SOA +short -t txt zhihu.com
;; Warning, extra type option
"m5g7qjk31l5d1hkq6m3zvcf6lg2f0h16"
"google-site-verification=q42VyLbU7bjRv5xb2279AX9jJ3Vuxp-e4XG_f1EQRGk"
"v=spf1 include:_spf.google.com include:cust-spf.edmsphere.com -all"

However, the next second I excute it, I get:

root@mx:/var/www/html/server# dig @8.8.8.8 SOA +short -t txt zhihu.com
;; Warning, extra type option
e4094fc1d98c915a.ksyunad.com.

And the e4094fc1d98c915a.ksyunad.com thing turns out to be a CNAME record value on zhihu.com in the DNS.

What's going on here?

已采纳解答

原帖链接 · Piotr P. Karwasz · CC BY-SA 4.0

Firstly you are asking for both the SOA and TXT record. The TXT query is sent and a warning is issued.

The main problem is that the domain zhihu.com is misconfigured:

  • since it is a delegated domain, it needs SOA and NS records,
  • the existence of a CNAME record is not compatible with almost all other records (except DNSSEC)

Therefore you have an inconsistent behaviour: each DNS resolver can resolve that incompatibility as he wants. 8.8.8.8 is an anycast address: each time you connect with a potentially different server.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-01-31)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。