开发者社区> 问答> 正文

云服务器 ECS Linux 系统下使用 dig 命令查询域名解析

云服务器 ECS Linux 系统下如何使用 dig 命令查询域名解析

展开
收起
开发者说 2019-07-12 16:46:00 2936 0
4 条回答
写回答
取消 提交回答
  • 最佳回答:

    语法:dig 域名

    image.png

    官方帮助文档地址:阿里云帮助中心

    更多参考: 阿里云官方(新用户需官网注册查看)

    2021-05-28 10:32:46
    赞同 展开评论 打赏
  • 语法:dig 域名 image.png 更多参考地址阿里云官方(新用户需官网注册查看)

    2021-03-07 21:54:57
    赞同 展开评论 打赏
  • 张扯淡
    语法:dig 域名
    2019-07-14 11:51:48
    赞同 展开评论 打赏
  • 查询域名 A 记录

    命令格式

    dig <域名>

    比如,查询域名 www.aliyun.com 的解析情况:

    $ dig www.aliyun.com

    ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.7 <<>> www.aliyun.com
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15919
    ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 2, ADDITIONAL: 4

    ;; QUESTION SECTION:
    ;www.aliyun.com. IN A

    ;; ANSWER SECTION:
    www.aliyun.com. 600 IN CNAME www-adns.aliyun.com.
    www-adns.aliyun.com. 300 IN CNAME www-adns.aliyun.com.gds.alibabadns.com.
    www-adns.aliyun.com.gds.alibabadns.com. 247 IN A 140.205.62.8

    ;; AUTHORITY SECTION:
    gds.alibabadns.com. 82 IN NS gdsns2.alibabadns.com.
    gds.alibabadns.com. 82 IN NS gdsns1.alibabadns.com.

    ;; ADDITIONAL SECTION:
    gdsns1.alibabadns.com. 877 IN A 140.205.122.66
    gdsns1.alibabadns.com. 877 IN A 198.11.138.254
    gdsns2.alibabadns.com. 877 IN A 140.205.67.254
    gdsns2.alibabadns.com. 877 IN A 140.205.122.88

    ;; Query time: 49 msec
    ;; SERVER: 10.242.197.247#53(10.242.197.247)
    ;; WHEN: Thu Jun 9 18:43:55 2016
    ;; MSG SIZE rcvd: 226

    查询域名解析在指定 DNS 服务器解析是否生效

    命令格式

    dig <域名> @<DNS 服务器地址>

    比如,查询 www.aliyun.com 在 223.5.5.5 DNS 服务器是否解析生效:

    $ dig www.aliyun.com @223.5.5.5; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.7 <<>> www.aliyun.com @223.5.5.5;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29651;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0;; QUESTION SECTION:;www.aliyun.com. IN A;; ANSWER SECTION:www.aliyun.com. 95 IN CNAME www-adns.aliyun.com. # 查询到的解析记录www-adns.aliyun.com. 95 IN CNAME www-adns.aliyun.com.gds.alibabadns.com. # 查询到的解析记录www-adns.aliyun.com.gds.alibabadns.com. 95 IN A 140.205.63.8;; Query time: 0 msec;; SERVER: 223.5.5.5#53(223.5.5.5);; WHEN: Thu Jun 9 18:44:42 2016;; MSG SIZE rcvd: 120

    查询域名的 CNAME 记录

    命令格式

    dig CNAME <域名>

    比如,查询域名 www.aliyun.com 的 CNAME 记录:

    # dig CNAME www.aliyun.com; <<>> DiG 9.9.4-RedHat-9.9.4-14.el7 <<>> CNAME www.aliyun.com;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4690;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 7;; OPT PSEUDOSECTION:; EDNS: version: 0, flags:; udp: 4096;; QUESTION SECTION:;www.aliyun.com. IN CNAME;; ANSWER SECTION:www.aliyun.com. 120 IN CNAME www-intl-adns.aliyun.com. # 查询到的 CNAME 信息;; AUTHORITY SECTION:aliyun.com. 172800 IN NS ns5.aliyun.com.aliyun.com. 172800 IN NS ns4.aliyun.com.aliyun.com. 172800 IN NS ns3.aliyun.com.;; ADDITIONAL SECTION:ns3.aliyun.com. 432000 IN A 42.120.250.251ns4.aliyun.com. 432000 IN A 110.75.20.27ns4.aliyun.com. 432000 IN A 140.205.71.248ns4.aliyun.com. 432000 IN A 42.156.241.248ns5.aliyun.com. 432000 IN A 140.205.2.187ns5.aliyun.com. 432000 IN A 198.11.138.248;; Query time: 10 msec;; SERVER: 10.202.72.118#53(10.202.72.118);; WHEN: Fri Jul 08 11:46:33 CST 2016;; MSG SIZE rcvd: 221

    查询 IP 反解记录

    命令格式:

    dig -x <目标 IP 地址>
    $ dig -x 140.205.62.8; <<>> DiG 9.9.4-RedHat-9.9.4-14.el7 <<>> -x 140.205.62.8;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 38256;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1;; OPT PSEUDOSECTION:; EDNS: version: 0, flags:; udp: 4096;; QUESTION SECTION:;8.62.205.140.in-addr.arpa. IN PTR;; AUTHORITY SECTION:140.in-addr.arpa. 945 IN SOA z.arin.net. dns-ops.arin.net. 2016031910 1800 900 691200 10800;; Query time: 3 msec;; SERVER: 10.202.72.118#53(10.202.72.118);; WHEN: Fri Jul 08 11:51:32 CST 2016;; MSG SIZE rcvd: 108

    查询域名的 mx 解析记录

     

    命令格式

    dig mx <目标域名>

    ?比如,查询域名 aliyun.com 的 mx 解析记录:

    $ dig mx aliyun.com; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.7 <<>> mx aliyun.com;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33606;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 7;; QUESTION SECTION:;aliyun.com. IN MX;; ANSWER SECTION:aliyun.com. 3600 IN MX 10 mx2.mail.aliyun.com.;; AUTHORITY SECTION:aliyun.com. 172800 IN NS ns4.aliyun.com.aliyun.com. 172800 IN NS ns3.aliyun.com.aliyun.com. 172800 IN NS ns5.aliyun.com.;; ADDITIONAL SECTION:mx2.mail.aliyun.com. 600 IN A 110.75.48.150ns3.aliyun.com. 432000 IN A 42.120.250.251ns4.aliyun.com. 432000 IN A 110.75.20.27ns4.aliyun.com. 432000 IN A 140.205.71.248ns4.aliyun.com. 432000 IN A 42.156.241.248ns5.aliyun.com. 432000 IN A 198.11.138.248ns5.aliyun.com. 432000 IN A 140.205.2.187;; Query time: 1 msec;; SERVER: 10.242.197.247#53(10.242.197.247);; WHEN: Thu Jun 9 18:59:44 2016;; MSG SIZE rcvd: 219
    2019-07-22 11:29:39
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Alibaba Cloud Linux 3 发布 立即下载
ECS系统指南之Linux系统诊断 立即下载
ECS运维指南 之 Linux系统诊断 立即下载