DIG command is very flexible tool for shows domain information and DNS lookups you can easily find out your domain name servers, MX records, A records, AAAA Record, TXT Record and other related informations.
Find Domain Information:
The below commnad is prints name servers and A record of domain name.
# dig thelinuxfaq.com
;; ANSWER SECTION:
thelinuxfaq.com. 3600 IN A 192.168.0.121
;; AUTHORITY SECTION:
thelinuxfaq.com. 172800 IN NS ns5.nameserver.com.
thelinuxfaq.com. 172800 IN NS ns6.nameserver.com.
;; ADDITIONAL SECTION:
ns5.nameserver.com. 163351 IN A 192.168.0.121
ns6.nameserver.com. 163351 IN A 192.168.0.122
# dig thelinuxfaq.com +short
192.168.0.196
192.168.0.197
A Record :
The A record maps a domain or subdomain to an IP address also we can say IP address points to domain name,
# dig redhat.com
;; ANSWER SECTION:
redhat.com. 60 IN A 209.132.183.105
;; AUTHORITY SECTION:
redhat.com. 600 IN NS ns1.redhat.com.
redhat.com. 600 IN NS ns3.redhat.com.
redhat.com. 600 IN NS ns2.redhat.com.
redhat.com. 600 IN NS ns4.redhat.com.
;; ADDITIONAL SECTION:
ns1.redhat.com. 172799 IN A 209.132.186.218
ns3.redhat.com. 172799 IN A 209.132.176.100
ns4.redhat.com. 172799 IN A 209.132.188.218
ns2.redhat.com. 172799 IN A 209.132.183.2
# dig redhat.com A +short
209.132.183.105
AAAA Record:
AAAA record is same as A record, this record for IPv6 IP addresses. A typical AAAA record looks like,
# dig google.com AAAA
;; ANSWER SECTION:
google.com. 300 IN AAAA 2404:6800:4003:c02::8b
;; AUTHORITY SECTION:
google.com. 111867 IN NS ns1.google.com.
google.com. 111867 IN NS ns4.google.com.
google.com. 111867 IN NS ns2.google.com.
google.com. 111867 IN NS ns3.google.com.
;; ADDITIONAL SECTION:
ns2.google.com. 111867 IN A 216.239.34.10
ns1.google.com. 111867 IN A 216.239.32.10
ns3.google.com. 111867 IN A 216.239.36.10
ns4.google.com. 111867 IN A 216.239.38.10
# dig google.com AAAA +short
2404:6800:4003:c02::8b
Name Server (NS):
NS spcefied to Name Servers, The NS record specifies an authoritative name server for given host. view your name servers which is pointing to your domain name,
# dig domainname.com NS
;; ANSWER SECTION:
domainname.com. 50915 IN NS ns2.nameserver.com.
domainname.com. 50915 IN NS ns1.nameserver.com.
;; Query time: 3 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Fri May 22 18:40:34 IST 2015
;; MSG SIZE rcvd: 85
# dig domainname.com NS +short
ns1.nameserver.com.
ns2.nameserver.com.
Mail Exchanger record (MX):
the MX record is used to sets the mail delivery destination for a domain name.
The below command to view your domain MX record
# dig domainname.com MX
;; QUESTION SECTION:
;domainname.com. IN MX
;; ANSWER SECTION:
domainname.com. 10041 IN MX 0 domainname.com.
;; AUTHORITY SECTION:
domainname.com. 61837 IN NS ns2.nameserver.com.
domainname.com. 61837 IN NS ns1.nameserver.com.
;; ADDITIONAL SECTION:
domainname.com. 4265 IN A 192.168.0.121
# dig domainname.com MX +short
0 domainname.com.
text record (TXT):
A TXT record provides about hold some text information to sources outside your domain. This can create an SPF record on nameservers also use to create a DKIM record for mail signing.
# dig domainname.com TXT
;; QUESTION SECTION:
;domainname.com. IN TXT
;; ANSWER SECTION:
domainname.com. 14400 IN TXT "v=spf1 ip4:192.168.0.121 a mx ~all"
;; AUTHORITY SECTION:
domainname.com. 61792 IN NS ns1.nameserver.com.
domainname.com. 61792 IN NS ns2.nameserver.com.
# dig domainname.com TXT +short
"v=spf1 ip4:192.168.0.121 a mx ~all"
Start of Authority (SOA):
SOA is information stored in a DNS zone with the name of the host where it was originally created, Each zone contains a single SOA record,
# dig domainname.com SOA
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;domainname.com. IN SOA
;; ANSWER SECTION:
domainname.com. 86396 IN SOA ns1.nameserver.com. support.domainname.com. 2015031801 86400 7200 3600000 86400
;; AUTHORITY SECTION:
domainname.com. 50991 IN NS ns2.nameserver.com.
domainname.com. 50991 IN NS ns1.nameserver.com.
# dig domainname.com SOA +short
ns1.nameserver.com. support.domainname.com. 2015031801 86400 7200 3600000 86400
All DNS Pointing:
# dig domainname.com ANY
;; QUESTION SECTION:
;domainname.com. IN ANY
;; ANSWER SECTION:
domainname.com. 14105 IN TXT "v=spf1 ip4:192.168.0.121 a mx ~all"
domainname.com. 9701 IN MX 0 domainname.com.
domainname.com. 3925 IN A 192.168.0.121
domainname.com. 61497 IN NS ns2.nameserver.com.
domainname.com. 61497 IN NS ns1.nameserver.com.
;; AUTHORITY SECTION:
domainname.com. 61497 IN NS ns1.nameserver.com.
domainname.com. 61497 IN NS ns2.nameserver.com.
;; ADDITIONAL SECTION:
domainname.com. 3925 IN A 192.168.0.121
DNS Check from a Server:
Some time if you have configured DNS setting for specific domain on different server and to know whether configuration is right?, use below command "@" symbol with that server IP address.
# dig domain2.com @192.168.0.191
;; QUESTION SECTION:
;domain2.com. IN A
;; ANSWER SECTION:
domain2.com. 3600 IN A 192.168.0.197
domain2.com. 3600 IN A 192.168.0.196
;; AUTHORITY SECTION:
domain2.com. 3600 IN NS ns5.dnsserver.com.
domain2.com. 3600 IN NS ns2.dnsserver.com.
;; ADDITIONAL SECTION:
ns1.dnsserver.com. 3600 IN A 192.168.0.181
ns2.dnsserver.com. 3600 IN A 192.168.0.191
Check Multiple domains :
If you need to check multiple domains at same time, create a file and add your domains, run the following command,
# dig -f domains.txt NS +noall +answer
# dig -f domains.txt A +noall +answer
# dig -f domains.txt CNAME +noall +answer
# dig -f domains.txt TXT +noall +answer
# dig -f domains.txt A +noall +answer
# dig -f domains.txt CNAME +noall +answer
# dig -f domains.txt TXT +noall +answer
Version :
Check your dig version,
# dig -v
DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6
Help:
Do you need more information about dig command,
# dig --help
# man dig
# man dig
Comments (0)