我在 ubuntu 18.04 下遇到 DNS 问题,因此我使用dig
命令来调试我的 DNS。
事情是这样的,当我挖掘像这样的网站redhat.com
或我的配置良好的 DNS 时,我总是会得到一个FORMERR
状态,并且它似乎SERVER
总是设置为 127.0.0.1:53。
➜ dig redhat.com
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> redhat.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: FORMERR, id: 14902
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 0929f0a01195f776 (echoed)
;; QUESTION SECTION:
;redhat.com. IN A
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Mar 19 11:17:10 CET 2019
;; MSG SIZE rcvd: 51
答案1
我修复了这个问题,并添加+noedns
了命令:
$ dig +noedns redhat.com
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> +noedns redhat.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47501
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;redhat.com. IN A
;; ANSWER SECTION:
redhat.com. 522 IN A 209.132.183.105
;; Query time: 51 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Mar 19 13:51:28 CET 2019
;; MSG SIZE rcvd: 44
希望能帮助到你 !