# DNS Tools

`dig` e `nslookup` sono strumenti di rete utilizzati per interrogare i server DNS. `dig` fornisce informazioni dettagliate e formattate sulle query DNS, mentre `nslookup` è un'interfaccia più semplice e interattiva per ottenere informazioni sui nomi di dominio. Entrambi sono utili per diagnosticare problemi di risoluzione dei nomi e per ottenere dettagli su record DNS specifici.

## nslookup

```bash
nslookup novemila.org
Server: 192.168.0.1         ## Server DNS locale, in questo casso il default gateway
Address:    192.168.0.1#53

Non-authoritative answer:       ## Le risposte non provengono da un server autoritativo
Name:   novemila.org
Address: 95.111.234.107         ## Record di tipo A
```

Una reverse lookup:

```bash
nslookup 95.111.234.107
;; Got recursion not available from 194.242.2.9, trying next server
107.234.111.95.in-addr.arpa name = vmi1757309.contaboserver.net.    ## Record di tipo PTR, che associano un IP a un hostname

Authoritative answers can be found from:
```

Infine, é possibile impostare il tipo di RR da richiedere:

```bash
nslookup -query=A continuity.space
Server: 192.168.0.1
Address:    192.168.0.1#53

Non-authoritative answer:
Name:   continuity.space
Address: 92.245.188.161

nslookup -query=MX continuity.space
Server: 192.168.0.1
Address:    192.168.0.1#53

Non-authoritative answer:
continuity.space    mail exchanger = 1 mailgate.continuity.srl.

Authoritative answers can be found from:
```

## dig

```bash
dig @1.1.1.1 continuity.space MX

; <<>> DiG 9.20.9-2-Debian <<>> @1.1.1.1 continuity.space MX
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64794
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;continuity.space.  IN  MX

;; ANSWER SECTION:
continuity.space.   900    IN  MX    1 mailgate.continuity.srl.

;; Query time: 103 msec
;; SERVER: 1.1.1.1#53(1.1.1.1) (UDP)
;; WHEN: Thu Jun 19 21:17:40 CEST 2025
;; MSG SIZE  rcvd: 84
```

Oppure, per richiedere un RR SOA:

```bash
dig @1.1.1.1 continuity.space SOA

; <<>> DiG 9.20.9-2-Debian <<>> @1.1.1.1 continuity.space SOA
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1072
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;continuity.space.  IN  SOA

;; ANSWER SECTION:
continuity.space.   900    IN  SOA   dns17.ovh.net. tech.ovh.net. 2025053000 86400 3600 3600000 300

;; Query time: 64 msec
;; SERVER: 1.1.1.1#53(1.1.1.1) (UDP)
;; WHEN: Thu Jun 19 21:18:57 CEST 2025
;; MSG SIZE  rcvd: 99
```
