Dig: Difference between revisions

From Psygen Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Basic Usage ==
dig (domain information groper) gets information from DNS servers.
dig (domain information groper) gets information from DNS servers.


<code>dig google.com</code> Gets DNS information for the specified hostname.
<code>dig google.com</code> Gets DNS information for the specified hostname.


You can query for specific DNS record types:
You can query for specific DNS record types:
Line 25: Line 28:
ns2.nameserver
ns2.nameserver
</pre>
</pre>
== Reverse DNS Lookup ==
You can also use dig to do a reverse DNS lookup (find out what domain name an IP address belongs to)
(you can remove the "+short" to see the entire record)
<pre>
dig -x 209.132.183.81 +short
www.redhat.com.
</pre>
== Query a Specific DNS Server ==
By default, dig asks the DNS server that your machine is set to use (usually set by DHCP, and will be your ISP, or company's DNS server.)
You can also use dig to ask a specific DNS server to perform the lookup.
<code>dig @ns1.redhat.com redhat.com</code> This will directly ask the redhat name server what the DNS records are for redhat.com
<code>dig @8.8.8.8 redhat.com</code> This will ask Google's public DNS server for the DNS records for redhat.com


== References: ==
== References: ==
Line 30: Line 52:
<ol>
<ol>
   <li>[http://man.he.net/?topic=dig&section=all dig man page]</li>
   <li>[http://man.he.net/?topic=dig&section=all dig man page]</li>
  <li>[http://www.thegeekstuff.com/2012/02/dig-command-examples Geek Stuff Dig Command Examples]</li>
</ol>
</ol>

Latest revision as of 00:47, 22 December 2016

Basic Usage

dig (domain information groper) gets information from DNS servers.

dig google.com Gets DNS information for the specified hostname.


You can query for specific DNS record types:

dig MX psygen.org Look for the mail exchanger records for the specified hostname.

dig NS psygen.org Look for the name server records for the specified hostname.

... and so on for any valid record type.

Short Form

You can use the short form to view just the info you need, instead of the whole record:

dig psygen.org +short
67.225.240.117
dig psygen.org ns +short
ns1.nameserver
ns2.nameserver

Reverse DNS Lookup

You can also use dig to do a reverse DNS lookup (find out what domain name an IP address belongs to) (you can remove the "+short" to see the entire record)

dig -x 209.132.183.81 +short
www.redhat.com.

Query a Specific DNS Server

By default, dig asks the DNS server that your machine is set to use (usually set by DHCP, and will be your ISP, or company's DNS server.) You can also use dig to ask a specific DNS server to perform the lookup.

dig @ns1.redhat.com redhat.com This will directly ask the redhat name server what the DNS records are for redhat.com

dig @8.8.8.8 redhat.com This will ask Google's public DNS server for the DNS records for redhat.com

References:

  1. dig man page
  2. Geek Stuff Dig Command Examples