Ubuntu/Commands/dig
From r00tedvw.com wiki
Commands | dig | Mail Server CLI | openssl
dig
dig (domain information groper) is a network administration command-line tool for querying Domain Name System (DNS) name servers.©
If you are missing dig from your Ubuntu installation, use this to install it.
~$ sudo apt-get install dnsutils
Command Syntax
dig [@server] [-t type] [-x addr]
- [@server]
- allows you to query a specific DNS server
- [-t type]
- allows you to query a specific type of DNS record, A,MX,PTR,CNAME,SOA,SRV,etc
- [-x addr] or [-x]
- performs a reverse lookup, matching address to name. The name has to be registered with .arpa in order for this to work.
Examples
$ dig -t a r00tedvw.com ; <<>> DiG 9.8.3-P1 <<>> -t a r00tedvw.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47382 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;r00tedvw.com. IN A ;; AUTHORITY SECTION: r00tedvw.com. 900 IN SOA ns21.domaincontrol.com. dns.jomax.net. 2013052201 28800 7200 604800 3600 ;; Query time: 106 msec ;; SERVER: 10.45.57.101#53(10.45.57.101) ;; WHEN: Sun Apr 12 18:56:24 2015 ;; MSG SIZE rcvd: 98
$ dig -t mx earthlink.net ; <<>> DiG 9.8.3-P1 <<>> -t mx earthlink.net ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18890 ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 4 ;; QUESTION SECTION: ;earthlink.net. IN MX ;; ANSWER SECTION: earthlink.net. 1768 IN MX 5 mx1.earthlink.net. earthlink.net. 1768 IN MX 5 mx2.earthlink.net. earthlink.net. 1768 IN MX 5 mx3.earthlink.net. earthlink.net. 1768 IN MX 5 mx4.earthlink.net. ;; ADDITIONAL SECTION: mx1.earthlink.net. 1564 IN A 209.86.93.226 mx2.earthlink.net. 1564 IN A 209.86.93.227 mx3.earthlink.net. 1564 IN A 209.86.93.228 mx4.earthlink.net. 1564 IN A 209.86.93.229 ;; Query time: 62 msec ;; SERVER: 10.45.57.101#53(10.45.57.101) ;; WHEN: Sun Apr 12 18:57:22 2015 ;; MSG SIZE rcvd: 175
$ dig -t srv _sip._tls.savvysaver.org ; <<>> DiG 9.8.5-P1 <<>> -t srv _sip._tls.savvysaver.org ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5579 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 2 ;; QUESTION SECTION: ;_sip._tls.savvysaver.org. IN SRV ;; ANSWER SECTION: _sip._tls.savvysaver.org. 3600 IN SRV 100 1 443 sipdir.online.lync.com. ;; ADDITIONAL SECTION: sipdir.online.lync.com. 300 IN A 132.245.113.25 sipdir.online.lync.com. 300 IN AAAA 2a01:111:f406:2400::10 ;; Query time: 153 msec ;; SERVER: 10.45.57.101#53(10.45.57.101) ;; WHEN: Fri Apr 11 19:41:56 EDT 2014 ;; MSG SIZE rcvd: 128
$ dig @8.8.8.8 -t mx earthlink.net ; <<>> DiG 9.8.3-P1 <<>> @8.8.8.8 -t mx earthlink.net ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54589 ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;earthlink.net. IN MX ;; ANSWER SECTION: earthlink.net. 1710 IN MX 5 mx3.earthlink.net. earthlink.net. 1710 IN MX 5 mx4.earthlink.net. earthlink.net. 1710 IN MX 5 mx1.earthlink.net. earthlink.net. 1710 IN MX 5 mx2.earthlink.net. ;; Query time: 33 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Sun Apr 12 19:02:38 2015 ;; MSG SIZE rcvd: 111