UNIX dig command, basic info
I recently became familiarized with dig or domain information groper, or in short it is the outstanding tool for DNS lookups. It has great functionally ant it is preinstalled on most of the distributions today.If we don't tell it to query a specific name server, dig will try each of the servers listed in /etc/resolv.conf.
The command goes something like this:
dig [ @server ] [ -b address ] [ -c class ] [ -f filename ] [ -k filename ] [ -p port# ] [ -t type ] [ -x addr ] [ -y name:key ] [ name ] [ type ] [ class ] [ queryopt... ]
dig [ -h ]
dig [ global-queryopt... ] [ query... ]
Examples
Or why I use dig mostly for. Let say I want to see all the redirects from the top level ns to my server.
Let say we want to know the MX records for a server, we write
http://www.manpagez.com/man/1/dig/
http://ss64.com/bash/dig.html
Other references
http://stackoverflow.com/questions/tagged/dig
The command goes something like this:
dig [ @server ] [ -b address ] [ -c class ] [ -f filename ] [ -k filename ] [ -p port# ] [ -t type ] [ -x addr ] [ -y name:key ] [ name ] [ type ] [ class ] [ queryopt... ]
dig [ -h ]
dig [ global-queryopt... ] [ query... ]
Examples
Or why I use dig mostly for. Let say I want to see all the redirects from the top level ns to my server.
dig mitemitreski.com +trace
and we get something like this:
; <<>> DiG 9.7.1-P2 <<>> mitemitreski.com +trace
;; global options: +cmd
. 46703 IN NS b.root-servers.net.
. 46703 IN NS k.root-servers.net.
. 46703 IN NS c.root-servers.net.
. 46703 IN NS e.root-servers.net.
. 46703 IN NS i.root-servers.net.
. 46703 IN NS g.root-servers.net.
. 46703 IN NS f.root-servers.net.
. 46703 IN NS d.root-servers.net.
. 46703 IN NS l.root-servers.net.
. 46703 IN NS a.root-servers.net.
. 46703 IN NS j.root-servers.net.
. 46703 IN NS h.root-servers.net.
. 46703 IN NS m.root-servers.net.
;; Received 228 bytes from
192.168.1.1#53(192.168.1.1) in 44 ms
com. 172800 IN NS f.gtld-servers.net.
com. 172800 IN NS d.gtld-servers.net.
com. 172800 IN NS a.gtld-servers.net.
com. 172800 IN NS l.gtld-servers.net.
com. 172800 IN NS i.gtld-servers.net.
com. 172800 IN NS b.gtld-servers.net.
com. 172800 IN NS m.gtld-servers.net.
com. 172800 IN NS k.gtld-servers.net.
com. 172800 IN NS j.gtld-servers.net.
com. 172800 IN NS h.gtld-servers.net.
com. 172800 IN NS c.gtld-servers.net.
com. 172800 IN NS e.gtld-servers.net.
com. 172800 IN NS g.gtld-servers.net.
;; Received 494 bytes from
128.8.10.90#53(d.root-servers.net) in 136 ms
mitemitreski.com. 172800 IN NS ns71.domaincontrol.com.
mitemitreski.com. 172800 IN NS ns72.domaincontrol.com.
;; Received 118 bytes from
192.55.83.30#53(m.gtld-servers.net) in 174 ms
mitemitreski.com. 3600 IN A 96.9.172.197
mitemitreski.com. 3600 IN NS ns71.domaincontrol.com.
mitemitreski.com. 3600 IN NS ns72.domaincontrol.com.
;; Received 102 bytes from
208.109.255.46#53(ns72.domaincontrol.com) in 126 ms
And basically we got the redirects from the top-level domains to our host.Let say we want to know the MX records for a server, we write
dig mx gmail.com
WE GET :
; <<>> DiG 9.7.1-P2 <<>> mx gmail.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23455
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0,
ADDITIONAL: 0
;; QUESTION SECTION:
;gmail.com. IN MX
;; ANSWER SECTION:
gmail.com. 3586 IN MX 30 alt3.gmail-smtp-in.l.google.com.
gmail.com. 3586 IN MX 10 alt1.gmail-smtp-in.l.google.com.
gmail.com. 3586 IN MX 40 alt4.gmail-smtp-in.l.google.com.
gmail.com. 3586 IN MX 20 alt2.gmail-smtp-in.l.google.com.
gmail.com. 3586 IN MX 5 gmail-smtp-in.l.google.com.
...
For the full description take a look at the dig man page or on-line at:http://www.manpagez.com/man/1/dig/
http://ss64.com/bash/dig.html
Other references
http://stackoverflow.com/questions/tagged/dig