{"id":24,"date":"2021-04-15T18:30:42","date_gmt":"2021-04-15T10:30:42","guid":{"rendered":"https:\/\/blog.wnstudio.net\/?p=24"},"modified":"2021-08-31T07:24:51","modified_gmt":"2021-08-30T23:24:51","slug":"dig","status":"publish","type":"post","link":"https:\/\/blog.wnstudio.net\/post\/dig\/","title":{"rendered":"dig"},"content":{"rendered":"\n
\"\"\/
Photo by Andres Siimon<\/a> on Unsplash<\/a><\/figcaption><\/figure><\/div>\n\n\n\n

dig \u2014 DNS lookup utility<\/p><\/blockquote>\n\n\n\n

man page \u958b\u5b97\u660e\u7fa9\u7684\u8aaa\uff0cdig \u662f\u500b DNS \u67e5\u627e\u5de5\u5177\uff0c\u4e5f\u662f\u8ddf CDN \u6253\u4ea4\u9053\u6642\u6700\u5e38\u7528\u7684\u6307\u4ee4\u4e4b\u4e00\u3002<\/p>\n\n\n\n

\u767d\u8a71\u7684\u8aaa\u660e\u5c31\u662f\uff1a\u7528\u4f86\u67e5\u67d0\u500b\u7db2\u5740\u6703\u9023\u5230\u54ea\u53f0\u4e3b\u6a5f\u3002<\/p>\n\n\n\n

\u57fa\u672c\u4f7f\u7528<\/h1>\n\n\n\n

dig \u6700\u57fa\u672c\u7684\u4f7f\u7528\u65b9\u5f0f\u662f<\/p>\n\n\n\n

dig example.com<\/pre>\n\n\n\n

\u52a0\u4e0a\u4e00\u9ede\u9ede\u7684\u53c3\u6578\uff0c\u5247\u662f<\/p>\n\n\n\n

dig [@server] [name] [type]<\/pre>\n\n\n\n

name \u4ee3\u8868\u4f60\u60f3\u67e5\u8a62\u7684 domain\uff1b type \u4ee3\u8868 record \u985e\u578b\uff0c\u5305\u542b\u4e86 A, AAAA, CNAME, ANY \u2026\u7b49\uff0c\u9810\u8a2d\u70ba A \uff1b@server\u5247\u662f\u6307\u4f60\u60f3 query \u7684 DNS \u4f3a\u670d\u5668\u3002<\/p>\n\n\n\n

\u6709\u8da3\u7684\u662f\uff0c\u5f8c\u9762\u53c3\u6578\u4f3c\u4e4e\u662f\u53ef\u4ee5\u4e92\u63db\u4f4d\u7f6e\u7684\uff0c\u4f8b\u5982\u8aaa<\/p>\n\n\n\n

dig @168.95.1.1 any www.apple.com
dig @168.95.1.1 www.apple.com any
dig www.apple.com @168.95.1.1 any<\/pre>\n\n\n\n

\u4ee5\u4e0a\u4e09\u7a2e\u8f38\u5165\u6703\u5f97\u5230\u4e00\u6a23\u7684\u7d50\u679c\uff0c\u6240\u4ee5\u53ef\u80fd\u6703\u5728\u4e0d\u540c\u7684\u4f7f\u7528\u8005\u6216\u662f\u8aaa\u660e\u9801\u4e0a\u770b\u5230\u4e0d\u540c\u7684\u9806\u5e8f\u3002<\/p>\n\n\n\n

\u4ee5 www.google.com<\/a> \u70ba\u4f8b\uff0c\u5f9e\u6211\u6240\u5728\u7684\u5730\u65b9dig www.google.com<\/a> <\/code>\u5f97\u5230\u9019\u500b\u7d50\u679c(\u7701\u53bb\u90e8\u4efd\u8f38\u51fa\uff0c\u4ee5\u4e0b\u7686\u540c)\uff1a<\/p>\n\n\n\n

; <<>> DiG 9.10.6 <<>> www.google.com<\/a>\n;; QUESTION SECTION:\n;www.google.com.   IN A\n;; ANSWER SECTION:\nwww.google.com.  208 IN A 172.217.160.100\n;; SERVER: 1.1.1.1#53(1.1.1.1)<\/pre>\n\n\n\n

\u5176\u4e2d\u770b\u5230 www.google.com.<\/a> 208 IN A 172.217.160.100 <\/code>\u9019\u662f\u4e00\u7b46 A record\uff0c\u4ee3\u8868 DNS \u89e3\u6790\u51fa\u4f86\u7684\u4e3b\u6a5f\uff0c\u4ee3\u8868\u4f60\u5728\u700f\u89bd\u5668\u8f38\u5165 www.google.com<\/a> \uff0cDNS\u6703\u544a\u8a34\u4f60\u628a request \u9001\u5230\u8a72\u4e3b\u6a5f\u3002<\/p>\n\n\n\n

\u800c\u00a0SERVER: 1.1.1.1#53(1.1.1.1)<\/code>\u00a0\u5247\u662f\u6211\u4f7f\u7528\u7684 Public DNS \uff0c\u5982\u679c\u4f60\u8a2d\u5b9a\u70ba google \u6216\u4e2d\u83ef\u96fb\u4fe1\uff0c\u90a3\u5c31\u6703\u662f 8.8.8.8 \u4e4b\u985e\u7684\u3002 53 Port \u662f DNS \u9810\u8a2d\u7684 Port \u3002(\u7a81\u7136\u5c31\u77e5\u9053 AWS Route 53 \u9019\u6a23\u547d\u540d\u7684\u539f\u56e0\u4e86\uff01)<\/p>\n\n\n\n

\u52a0\u9ede\u6599<\/h1>\n\n\n\n

@nameserver<\/h2>\n\n\n\n

\u6709\u6642\u5019\u56e0\u70ba\u5404\u5f0f\u5404\u6a23\u7684\u539f\u56e0\uff0c\u4f60\u5e0c\u671b\u628a query \u9001\u7d66\u4e0d\u540c\u7684 DNS \uff0c\u8acb\u52a0\u4e0a\u9019\u500b\u53c3\u6578\u3002\u4f8b\u5982\u8aaa <\/p>\n\n\n\n

dig www.apple.com @1.1.1.1<\/code>\ndig www.apple.com @8.8.8.8<\/pre>\n\n\n\n

ANY<\/h2>\n\n\n\n

\u4e00\u7a2e\u7279\u6b8a\u7684 record type\uff0cANY \u6703\u5217\u51fa\u6240\u6709\u627e\u5230\u7684record\u3002<\/p>\n\n\n\n

\u2026\u672c\u4f86\u61c9\u8a72\u662f\u9019\u6a23\u7684\uff0c\u4f46\u662f\u6211\u5728\u6574\u7406\u9019\u7bc7\u7b46\u8a18\u7684\u6642\u5019\u537b\u767c\u73fe\uff0c\u5e0c\u671b\u62ff\u5230 anything \u7684\u6642\u5019, dig \u537b\u7d66\u4f60 nothing\u3002<\/p>\n\n\n\n

\u770b\u770b dig www.apple.com<\/a><\/code> \u7684\u8f38\u51fa\uff1a<\/p>\n\n\n\n

; <<>> DiG 9.10.6 <<>> www.apple.com\n;; ANSWER SECTION:\nwww.apple.com.  1794 IN CNAME www.apple.com.edgekey.net.\nwww.apple.com.edgekey.net. 21594 IN CNAME www.apple.com.edgekey.net.globalredir.akadns.net.\nwww.apple.com.edgekey.net.globalredir.akadns.net. 3594 IN CNAME e6858.dscx.akamaiedge.net.\ne6858.dscx.akamaiedge.net. 14 IN A 23.48.141.18<\/pre>\n\n\n\n

\u9019\u4ee3\u8868 www.apple.com<\/a> \u8a2d\u5b9a\u4e86 cname \uff0c\u4e00\u8def\u627e\u5230\u6700\u5f8c\u62ff\u5230 A record \u662f 23.48.141.18 \u3002<\/p>\n\n\n\n

\u518d\u770b\u770b\u52a0\u4e0a ANY dig www.apple.com<\/a> ANY<\/code> \u7684\u7d50\u679c\uff1a<\/p>\n\n\n\n

; <<>> DiG 9.10.6 <<>> \nwww.apple.com any\n;; QUESTION SECTION:\n;www.apple.com.   IN ANY<\/pre>\n\n\n\n

\u86e4\uff1f\u4e0d\u6b62\u6c92\u6709\u7d50\u679c\uff0c\u9023 ANSWER SECTION \u90fd\u4e0d\u898b\u4e86\uff1f<\/p>\n\n\n\n

\u5f8c\u4f86\u627e\u5230 Cloudflare \u7684\u8aaa\u660e<\/a>\uff0cANY \u5df2\u7d93\u5728 RFC8482 \u4e2d\u6b63\u5f0f\u68c4\u7528\uff0c\u800c\u4e14\u5c0d\u65bc\u68c4\u7528\u5f8c\u7684 response \u6c92\u6709\u660e\u78ba\u7684\u6a19\u6e96\uff0c\u4e5f\u5c31\u662f\u8aaa\uff0c\u6703\u6839\u64da DNS \u6709\u6240\u4e0d\u540c<\/p>\n\n\n\n

\u4f8b\u5982\u8aaa\uff0c\u5982\u679c\u7528\u4e2d\u83ef\u96fb\u4fe1\u7684 DNS \u6703\u5f97\u5230\u4e0d\u592a\u4e00\u6a23\u7684\u7d50\u679c\uff1a<\/p>\n\n\n\n

; <<>> DiG 9.10.6 <<>> www.apple.com ANY @168.95.1.1\n...\n;; ANSWER SECTION:\nwww.apple.com.  1758 IN CNAME www.apple.com.edgekey.net.<\/pre>\n\n\n\n

\u5927\u90e8\u4efd\u95dc\u65bc dig \u7684\u8aaa\u660e\u90fd\u6703\u63d0\u5230\u9019\u500b ANY \uff0c\u62ff\u4f86\u4f7f\u7528\u4e5f\u4e0d\u6703\u62ff\u5230\u5f88\u660e\u986f\u7684\u932f\u8aa4\u8a0a\u606f\uff0c\u4f46\u56e0\u70ba\u7d50\u679c\u6709\u5f88\u9ad8\u7684\u4e0d\u78ba\u5b9a\u6027\uff0c\u4f7f\u7528\u4e0a\u5fc5\u9700\u7279\u5225\u6ce8\u610f\u3002<\/p>\n\n\n\n

+trace<\/h2>\n\n\n\n

\u5217\u51fa Query \u4e00\u8def\u904e\u95dc\u65ac\u5c07\u7684\u6b77\u7a0b\uff0c\u6211\u5011\u9084\u662f\u7528 www.apple.co<\/a>m \u4f86\u770b\u770b\uff1a<\/p>\n\n\n\n

dig www.apple.com<\/a> +trace\n; <<>> DiG 9.10.6 <<>> www.apple.com A +trace\n...\n.   510971 IN NS f.root-servers.net.\n.   510971 IN NS g.root-servers.net.\n.   510971 IN NS h.root-servers.net.\n...\n;; Received 525 bytes from 1.1.1.1#53(1.1.1.1) in 10 ms\n...\ncom.   172800 IN NS c.gtld-servers.net.\n...\n;; Received 1173 bytes from 192.5.5.241#53(f.root-servers.net) in 11 ms\napple.com.  172800 IN NS a.ns.apple.com.\napple.com.  172800 IN NS b.ns.apple.com.\n;; Received 778 bytes from 192.35.51.30#53(f.gtld-servers.net) in 45 ms\nwww.apple.com.  1800 IN CNAME www.apple.com.edgekey.net.\n;; Received 81 bytes from 204.26.57.1#53(d.ns.apple.com) in 88 ms<\/pre>\n\n\n\n

(\u9019\u6b21\u7684\u8f38\u51fa\u5f88\u9577\uff0c\u522a\u6389\u6eff\u591a\u7684)\uff0c\u4f46\u4ecd\u53ef\u4ee5\u770b\u5230\u4e00\u8def\u8f49\u767c\u7684\u904e\u7a0b\uff1a<\/p>\n\n\n\n

\u5f9e root (.) \u7684 13 \u53f0server\uff0c\u67e5\u5230 .com. gTLD \uff0c \u518d\u5f9e gTLD \u7684 server \u67e5\u5230 apple.com. \u6700\u5f8c\u62ff\u5230 www.apple.com.edgekey.net.<\/a><\/code> \u8a73\u7d30\u7684Name Server \u67b6\u69cb\u53ef\u4ee5\u53c3\u8003\u9ce5\u54e5\u7684\u6587\u7ae0<\/a>\u3002<\/p>\n\n\n\n


\n\n\n\n

\u52a0\u66f4\u591a\u6599<\/h1>\n\n\n\n

\u4e00\u9ede\u500b\u4eba\u958b\u767c\u914d\u8457\u7528\u7684\u5c0f\u624b\u6bb5 &\u597d\u7528\u5de5\u5177<\/p>\n\n\n\n

\u914d\u5408 watch \u4f7f\u7528 watch -n 10 dig www.apple.com<\/a><\/code><\/p>\n\n\n\n

\u79d1\u6280\u59cb\u7d42\u4f86\u81ea\u65bc\u60f0\u6027\u3002DNS \u751f\u6548\u5e38\u5e38\u9700\u8981\u4e00\u5b9a\u7684\u6642\u9593\uff0c\u6bcf\u5341\u79d2\u81ea\u52d5\u6316\u4e00\u6b21\u5c31\u4e0d\u7528\u4e09\u4e0d\u4e94\u6642\u81ea\u5df1\u770b\u4e86\u3002<\/p>\n\n\n\n

whatsmydns<\/h2>\n\n\n\n

\u7db2\u8def\u670d\u52d9\uff0c\u53ef\u4ee5\u5feb\u901f\u7684\u5f9e\u4e16\u754c\u5404\u8655\u67e5 DNS \u89e3\u6790<\/p>\n\n\n\n

DNS Checker<\/a><\/p>\n\n\n\n

\u7db2\u8def\u7248\u7684 Dig<\/h2>\n\n\n\n

\u8b93\u696d\u52d9\u4e4b\u985e\u7684\u975e\u6280\u8853\u4eba\u54e1\uff0c\u96fb\u8166\u6c92\u6709\u88dddig\u53c8\u81e8\u6642\u9700\u8981\u7528\u5230\u7684\u4eba\u4f7f\u7528<\/p>\n\n\n\n

https:\/\/toolbox.googleapps.com\/apps\/dig\/<\/a><\/p>\n\n\n\n

references<\/h1>\n\n\n\n

RFC8482 – Saying goodbye to ANYLadies and gentlemen, I would like you to welcome the new shiny RFC8482, which effectively deprecates DNS ANY query\u2026blog.cloudflare.com<\/a><\/p>\n\n\n\n

\u9ce5\u54e5\u7684 Linux \u79c1\u623f\u83dc — DNS Server2002\/12\/10\uff1a\u9996\u6b21\u5b8c\u6210 \u6211\u5011\u90fd\u77e5\u9053\uff0c\u5728\u300e\u8a18\u61b6\u300f\u7684\u89d2\u8272\u4e0a\uff0c\u4eba\u8166\u7e3d\u662f\u4e0d\u5982\u96fb\u8166\u7684\uff0c\u800c\u4eba\u5011\u5c0d\u6587\u5b57\u7684\u5370\u8c61\u53c8\u6bd4\u6578\u5b57\u9ad8\u3002\u56e0\u6b64\uff0c\u60f3\u8981\u4f7f\u7528\u7d14\u7cb9\u7684 TCP\/IP \u4f86\u4e0a\u7db2\uff0c\u5be6\u5728\u4e0d\u597d\u8a18\u61b6\u53c8\u5f88\u9ebb\u7169\u3002\u70ba\u4e86\u9069\u61c9\u4eba\u985e\u7684\u4f7f\u7528\u7fd2\u6163\uff0c\u56e0\u6b64\u4e00\u500b\u540d\u70ba DNS\u2026linux.vbird.org<\/a><\/p>\n\n\n\n

RFC 8482 – Providing Minimal-Sized Responses to DNS Queries That Have QTYPE=ANYInternet Engineering Task Force (IETF) J. Abley Request for Comments: 8482 Afilias Updates: 1034, 1035 O. Gudmundsson\u2026tools.ietf.org<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

dig\u6307\u4ee4 dig\u600e\u9ebc\u7528<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[10,11],"_links":{"self":[{"href":"https:\/\/blog.wnstudio.net\/wp-json\/wp\/v2\/posts\/24"}],"collection":[{"href":"https:\/\/blog.wnstudio.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wnstudio.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wnstudio.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wnstudio.net\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":0,"href":"https:\/\/blog.wnstudio.net\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.wnstudio.net\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wnstudio.net\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wnstudio.net\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}