8 Comandi Linux Nslookup per Risolvere i Problemi DNS (Domain Name Server)

nslookup è uno strumento amministrativo da riga di comando per testare e risolvere i server DNS (Domain Name Server). Viene utilizzato anche per interrogare specifici record di risorse DNS (RR). La maggior parte dei sistemi operativi include una funzionalità nslookup integrata.

Questo articolo illustra dettagliatamente il comando nslookup ampiamente utilizzato. Nslookup può essere eseguito in due modalità: Interattiva e Non Interattiva.

La modalità Interattiva viene utilizzata per interrogare il DNS-Server su vari domini e host. La modalità Non Interattiva viene utilizzata per interrogare informazioni su un dominio o host.

Potresti essere interessato anche al seguente articolo :

1. Scopri il record “A” (indirizzo IP) del dominio

# nslookup yahoo.com

Server:         4.2.2.2
Address:        4.2.2.2#53

Non-authoritative answer:
Name:   yahoo.com
Address: 72.30.38.140
Name:   yahoo.com
Address: 98.139.183.24
Name:   yahoo.com
Address: 209.191.122.70

Il comando sopra interroga il dominio www.yahoo.com con il server DNS pubblico 4.2.2.2 e la sezione sottostante mostra Risposta non autorevole: visualizza il record A di www.yahoo.com

2. Scopri la Ricerca del Dominio Inverso

# nslookup 209.191.122.70

Server:         4.2.2.2
Address:        4.2.2.2#53

Non-authoritative answer:
70.122.191.209.in-addr.arpa     name = ir1.fp.vip.mud.yahoo.com.

Authoritative answers can be found from:

3. Scopri una Ricerca di Dominio Specifica

# nslookup ir1.fp.vip.mud.yahoo.com.

Server:         4.2.2.2
Address:        4.2.2.2#53

Non-authoritative answer:
Name:   ir1.fp.vip.mud.yahoo.com
Address: 209.191.122.70

4. Per interrogare il record MX (Mail Exchange)

# nslookup -query=mx www.yahoo.com

Server:         4.2.2.2
Address:        4.2.2.2#53

Non-authoritative answer:
www.yahoo.com   canonical name = fd-fp3.wg1.b.yahoo.com.
fd-fp3.wg1.b.yahoo.com  canonical name = ds-fp3.wg1.b.yahoo.com.
ds-fp3.wg1.b.yahoo.com  canonical name = ds-any-fp3-lfb.wa1.b.yahoo.com.
ds-any-fp3-lfb.wa1.b.yahoo.com  canonical name = ds-any-fp3-real.wa1.b.yahoo.com.

Authoritative answers can be found from:
wa1.b.yahoo.com
        origin = yf1.yahoo.com
        mail addr = hostmaster.yahoo-inc.com
        serial = 1344827307
        refresh = 30
        retry = 30
        expire = 86400
        minimum = 1800

Il record MX viene utilizzato per mappare un nome di dominio a un elenco di server di scambio di posta per quel dominio. Quindi indica che qualsiasi posta ricevuta/inviata a @yahoo.com verrà instradata al server di posta.

5. Per interrogare il record NS (Name Server)

# nslookup -query=ns www.yahoo.com

Server:         4.2.2.2
Address:        4.2.2.2#53

Non-authoritative answer:
www.yahoo.com   canonical name = fd-fp3.wg1.b.yahoo.com.
fd-fp3.wg1.b.yahoo.com  canonical name = ds-fp3.wg1.b.yahoo.com.
ds-fp3.wg1.b.yahoo.com  canonical name = ds-any-fp3-lfb.wa1.b.yahoo.com.
ds-any-fp3-lfb.wa1.b.yahoo.com  canonical name = ds-any-fp3-real.wa1.b.yahoo.com.

Authoritative answers can be found from:
wa1.b.yahoo.com
        origin = yf1.yahoo.com
        mail addr = hostmaster.yahoo-inc.com
        serial = 1344827782
        refresh = 30
        retry = 30
        expire = 86400
        minimum = 1800

6. Per interrogare il record SOA (Start of Authority)

# nslookup -type=soa www.yahoo.com

Server:         4.2.2.2
Address:        4.2.2.2#53

Non-authoritative answer:
www.yahoo.com   canonical name = fd-fp3.wg1.b.yahoo.com.
fd-fp3.wg1.b.yahoo.com  canonical name = ds-fp3.wg1.b.yahoo.com.
ds-fp3.wg1.b.yahoo.com  canonical name = ds-any-fp3-lfb.wa1.b.yahoo.com.
ds-any-fp3-lfb.wa1.b.yahoo.com  canonical name = ds-any-fp3-real.wa1.b.yahoo.com.

Authoritative answers can be found from:
wa1.b.yahoo.com
        origin = yf1.yahoo.com
        mail addr = hostmaster.yahoo-inc.com
        serial = 1344827965
        refresh = 30
        retry = 30
        expire = 86400
        minimum = 1800

7. Per interrogare tutti i Record DNS Disponibili

# nslookup -query=any yahoo.com

Server:         4.2.2.2
Address:        4.2.2.2#53

Non-authoritative answer:
yahoo.com
        origin = ns1.yahoo.com
        mail addr = hostmaster.yahoo-inc.com
        serial = 2012081016
        refresh = 3600
        retry = 300
        expire = 1814400
        minimum = 600
Name:   yahoo.com
Address: 98.139.183.24
Name:   yahoo.com
Address: 209.191.122.70
Name:   yahoo.com
Address: 72.30.38.140
yahoo.com       mail exchanger = 1 mta7.am0.yahoodns.net.
yahoo.com       mail exchanger = 1 mta5.am0.yahoodns.net.
yahoo.com       mail exchanger = 1 mta6.am0.yahoodns.net.
yahoo.com       nameserver = ns3.yahoo.com.
yahoo.com       nameserver = ns4.yahoo.com.
yahoo.com       nameserver = ns2.yahoo.com.
yahoo.com       nameserver = ns8.yahoo.com.
yahoo.com       nameserver = ns1.yahoo.com.
yahoo.com       nameserver = ns6.yahoo.com.
yahoo.com       nameserver = ns5.yahoo.com.

Authoritative answers can be found from:

8. Abilita la modalità Debug

Per abilitare la Modalità Debug ‘set debug’ restituirà informazioni dettagliate come TTL, ecco l’output.

# nslookup -debug yahoo.com

> set debug
> yahoo.com
Server:         4.2.2.2
Address:        4.2.2.2#53

------------
    QUESTIONS:
        yahoo.com, type = A, class = IN
    ANSWERS:
    ->  yahoo.com
        internet address = 72.30.38.140
        ttl = 1523
    ->  yahoo.com
        internet address = 98.139.183.24
        ttl = 1523
    ->  yahoo.com
        internet address = 209.191.122.70
        ttl = 1523
    AUTHORITY RECORDS:
    ADDITIONAL RECORDS:
------------
Non-authoritative answer:
Name:   yahoo.com
Address: 72.30.38.140
Name:   yahoo.com
Address: 98.139.183.24
Name:   yahoo.com
Address: 209.191.122.70

In questo articolo, abbiamo cercato di coprire i comandi nslookup che possono aiutarti a cercare informazioni correlate al Servizio di Nomi di Dominio (DNS).

Il prossimo articolo sarà sul comando Linux dig, che è simile a nslookup. Se ti è piaciuto l’articolo, condividilo con i tuoi amici e non dimenticare di dare il tuo prezioso feedback attraverso il box dei commenti.

Source:
https://www.tecmint.com/8-linux-nslookup-commands-to-troubleshoot-dns-domain-name-server/