Cloud Server ECS Linux system can use the usual dig command to query the domain name resolution. This article gives a brief description of this.
Querying Domain A Records
command Format :
dig <域名>
For example, the query domain name www.aliyun.com parsing situation:
$ 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. In the CNAME www-adns.aliyun.com.www-adns.aliyun.com. 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. Gdsns2.alibabadns.com.gds.alibabadns.com in NS. Gdsns1.alibabadns.com in NS.; ADDITIONAL SECTION:gdsns1.alibabadns.com. 877 in A 140.205.122.66gdsns1.alibabadns.com. 877 in A 198.11.138.254gdsns2.alibabadns.com. 877 in A 140.205.67.254gdsns2.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 June 9 18:43:55 2016;; MSG SIZE rcvd:226
Query domain name resolution is in effect at the specified DNS server resolution
command Format :
dig <域名> @<DNS 服务器地址>
For example, query www.aliyun.com if the 223.5.5.5 DNS server resolves to take effect:
$ 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
Query a CNAME record for a domain name
command Format :
dig CNAME <域名>
For example, query the CNAME record for the domain name www.aliyun.com :
# 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.incname; ANSWER section:www.aliyun.com.120incnamewww-intl-adns.aliyun.com. # Query to the CNAME information;; Authority section: Aliyun.com.172800innsns5.aliyun.com.aliyun.com.172800innsns4.aliyun.com.aliyun.com.172800innsns3.aliyun.com.;; ADDITIONAL section: Ns3.aliyun.com.432000ina42.120.250.251ns4.aliyun.com.432000ina110.75.20.27ns4.aliyun.com.432000ina140.205.71.248ns4.aliyu n.com.432000ina42.156.241.248ns5.aliyun.com.432000ina140.205.2.187ns5.aliyun.com.432000ina198.11.138.248;; Query time:10 msec;; server:10.202.72.118#53 (10.202.72.118); When:fri Jul 11:46:33 CST 2016;; MSG SIZE rcvd:221
Querying IP Reverse-Solution Records
Command format:
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.INPTR;; AUTHORITY SECTION:140.in-addr.arpa.945INSOAz.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
Querying MX parsing records for domain names
command Format :
dig mx <目标域名>
For example, query the MX parsing record for domain name aliyun.com:
$ 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 ten 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. 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 June 9 18:59:44 2016;; MSG SIZE rcvd:219
Cloud Server ECS Linux system query domain name resolution using the DIG command