Dig (domain information groper) este un puternic instrument de linie de comanda pentru administrarea retelei pentru interogarea nameserverelor DNS. Face parte din suita de software pentru serverul de nume de domeniu BIND si accepta interogari IDN (Internationalized Domain Name).

Iata 10 interogari DNS rezolvate cu ajutorul comenzii DIG care va vor ajuta sa gasiti informatii specifice domeniului dvs.

 

1. Gasiti adresa IP a websitului

Rezultatul va afisa adresa IP a site-ului dvs. web. Utilizarea +short scapa de toate liniile de iesire inutile si va arata doar subiectul dorit. Deschideti terminalul si tastati, dupa cum urmeaza:

Command Line:
$ dig example.com +short

Output:
1.2.3.4

2. Gasiti nameserverele responsabile pentru domeniul dvs.

Aceasta va va arata unde este gazduita zona DNS si cu cate nameservere este asociat domeniul.

Command Line:

$ dig NS example.com +short

Output:
ns1.example.com.
ns2.example.com.
ns3.example.com.
ns4.example.com.

3. Gasiti calea delegarii catre zona dvs. DNS

Utilizand dig + trace, interogarile arata direct calea de pe serverele root catre Zona DNS.

Command Line:
$ dig example.com +trace

Output:
; <<>> DiG 9.9.5-3ubuntu0.7-Ubuntu <<>> example.com +trace
;; global options: +cmd
. 3493 IN NS a.root-servers.net.
. 3493 IN NS b.root-servers.net.
. 3493 IN NS c.root-servers.net.
. 3493 IN NS d.root-servers.net.
. 3493 IN NS e.root-servers.net.
. 3493 IN NS f.root-servers.net.
. 3493 IN NS g.root-servers.net.
. 3493 IN NS h.root-servers.net.
. 3493 IN NS i.root-servers.net.
. 3493 IN NS j.root-servers.net.
. 3493 IN NS k.root-servers.net.
. 3493 IN NS l.root-servers.net.
. 3493 IN NS m.root-servers.net.
;; Received 397 bytes from 127.0.1.1#53(127.0.1.1) in 466 ms

com. 172800 IN NS a.gtld-servers.net.
com. 172800 IN NS b.gtld-servers.net.
com. 172800 IN NS c.gtld-servers.net.
com. 172800 IN NS d.gtld-servers.net.
com. 172800 IN NS e.gtld-servers.net.
com. 172800 IN NS f.gtld-servers.net.
com. 172800 IN NS g.gtld-servers.net.
com. 172800 IN NS h.gtld-servers.net.
com. 172800 IN NS i.gtld-servers.net.
com. 172800 IN NS j.gtld-servers.net.
com. 172800 IN NS k.gtld-servers.net.
com. 172800 IN NS l.gtld-servers.net.
com. 172800 IN NS m.gtld-servers.net.
;; Received 734 bytes from 192.203.230.10#53(e.root-servers.net) in 496 ms

example.com. 172800 IN NS ns2.example.com.
example.com. 172800 IN NS ns1.example.com.
example.com. 172800 IN NS ns3.example.com.
example.com. 172800 IN NS ns4.example.com.
;; Received 660 bytes from 192.55.83.30#53(m.gtld-servers.net) in 229 ms

example.com. 300 IN A 1.2.3.4
example.com. 300 IN NS ns1.example.com
example.com. 300 IN NS ns2.example.com
example.com. 300 IN NS ns3.example.com
example.com. 300 IN NS ns4.example.com
;; Received 44 bytes from 216.239.34.10#53(ns2.example.com) in 40 ms

4. Gasiti mailserverul responsabil pentru domeniul dvs.

Se poate verifica folosind urmatorul exemplu:

Command Line:
$ dig MX example.com +short

Output:
1 ASPMX.L.GOOGLE.COM.
5 ALT1.ASPMX.L.GOOGLE.COM.
5 ALT2.ASPMX.L.GOOGLE.COM.
10 ALT3.ASPMX.L.GOOGLE.COM.
10 ALT4.ASPMX.L.GOOGLE.COM.

5. Gasiti adresa IP cu care este asociat un nume de domeniu

Poate fi identificata datorita inregistrarilor PTR. in timp ce inregistrarea A asociaza un nume de domeniu cu o adresa IP, inregistrarea PTR asociaza adresa IP cu un nume de domeniu.

Command Line:
$ dig -x 1.2.3.4

Output:
example.com

6. Gasiti nameserverele responsabile pentru TLD-uri (domenii de nivel superior)

Pentru a le verifica, utilizati urmatoarea linie de comanda:

Command Line:
dig NS com +short

Output:
j.gtld-servers.net.
a.gtld-servers.net.
i.gtld-servers.net.
d.gtld-servers.net.
f.gtld-servers.net.
b.gtld-servers.net.
h.gtld-servers.net.
e.gtld-servers.net.
m.gtld-servers.net.
k.gtld-servers.net.
c.gtld-servers.net.
g.gtld-servers.net.
l.gtld-servers.net.

7. Verificati daca zona dvs. DNS este sincronizata pe toate nameserverele autoritare

Deschideti terminalul si tastati, dupa cum urmeaza:

Command Line:
$ dig example.com +nssearch

Output:
SOA ns1.example.com. dns-admin.example.com. 2016042102 7200 1800 1209600 300 from server ns3.example.com in 14 ms.
SOA ns1.example.com. dns-admin.example.com. 2016042102 7200 1800 1209600 300 from server ns2.example.com in 22 ms.
SOA ns1.example.com. dns-admin.example.com. 2016042102 7200 1800 1209600 300 from server ns4.example.com in 88 ms.
SOA ns1.example.com. dns-admin.example.com. 2016042102 7200 1800 1209600 300 from server ns1.example.com in 125 ms.

8. Verificati cand expira memoria cache a unui raspuns

Deschideti terminalul si introduceti urmatoarea linie de comanda. Rezultatul va fi afisat in coloana 2.

Command Line:
$ dig example.com +noall +answer

Output:
;; global options: +cmd
example.com. 109 IN A 1.2.3.4
example.com. 109 IN A 1.2.3.4;; ->>HEADERexample.com. 109 IN A 1.2.3.4
example.com. 109 IN A 1.2.3.4

9. Verificati existenta unei zone pe un nameserver

Deschideti terminalul si introduceti urmatoarea linie de comanda:

Command Line:
$ dig SOA example.com @ns1.example.com

Rezultatele sunt afisate in antetul rezultatului. Daca domeniul exista, raspunsul este similar cu urmatorul:

;; ->>HEADER<

*Understanding the statuses:
NOERROR - the zone exists
NXDOMAIN - non-existent domain
REFUSED - the name server refuses to perform the operation

10. Verificati ce valoare este in cache intr-un resolver dat

Deschideti terminalul si tastati linia de comanda:

Command Line: $ dig example.com @8.8.8.8

Output:
;; global options: +cmd
;; Got answer:
;; ->>HEADER<;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;google.com. IN A

;; ANSWER SECTION:
example.com. 300 IN A 1.2.3.4
example.com. 300 IN A 1.2.3.4
example.com. 300 IN A 1.2.3.4
example.com. 300 IN A 1.2.3.4
example.com. 300 IN A 1.2.3.4
example.com. 300 IN A 1.2.3.4