dig

Domain name query tool

Supplementary instructions

dig command is a commonly used domain name query tool that can be used to test whether the domain name system is working properly.

grammar

dig(option)(parameter)

Options

@<server address>: specifies the domain name server for domain name resolution;
-b<ip address>: When the host has multiple IP addresses, specify which IP address of the local machine is used to send the domain name query request to the domain name server;
-f<file name>: specifies dig to run in batch mode, and the specified file stores DNS task information that requires batch query;
-P: Specify the port number used by the domain name server;
-t<type>: Specify the DNS data type to be queried;
-x<IP address>: perform reverse domain name query;
-4: Use IPv4;
-6: Use IPv6;
-h: Display command help information.

Parameters

Example

[root@localhost ~]# dig www.baidu.com

; <<>> DiG 9.10.6 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57295
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.baidu.com. IN A

;; ANSWER SECTION:
www.baidu.com. 963 IN CNAME www.a.shifen.com.
www.a.shifen.com. 63 IN A 180.101.50.242
www.a.shifen.com. 63 IN A 180.101.50.188

;; Query time: 14 msec
;; SERVER: 119.29.29.29#53(119.29.29.29)
;; WHEN: Wed May 10 16:16:36 CST 2023
;; MSG SIZE rcvd: 101