Saturday, 23 April 2016

What is the use of dig command ?


dig is used to get the information from a website (DNS lookup)

dig = Domain Info Groper

$ dig google.com
....
->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62863

QUESTION SECTION : Your input here
....
ANSWER SECTION : Answer received from the DNS
....
AUTHORITY SECTION : DNS (available) name servers that have authority to respond to this query
....
ADDITIONAL SECTION : Address of name servers listed in the AUTHORITY SECTION
....
Stats SECTION : Statistics including how much time it took to execute this query
 
 
View short output - just the IP address of a web site
 
$ dig redhat.com +short
209.132.183.81



Using DNS server

By default, dig command uses the DNS servers defined in your /etc/resolv.conf file.
$ dig google.com


If you want to use a different DNS server to perform the query, use @dnsserver

Example
$ dig google.com @ns1.google.com

It will use ns1.google.com as the DNS server to get the answer 
instead of using the DNS servers from the /etc/resolv.conf file.
 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.