Commandes Linux : nslookup

NSLOOKUP

Installé avec le paquet dnsutils
Voir aussi : dig et host.

 

Préférer les commandes dans cet ordre (niveau de détails retournés)

  1. dig
  2. host
  3. nslookup

 

Afficher la version de la commande nslookup

apt-cache policy dnsutils

 

Afficher les enregistrements de type A d’un domaine ou hôte en consultant les serveurs DNS

nslookup opensharing.priv

ex :

# nslookup opensharing.priv
Server:		127.0.0.1
Address:	127.0.0.1#53

Name:	opensharing.priv
Address: 192.168.1.14
nslookup www.opensharing.priv

ex :

# nslookup www.opensharing.priv
Server:		127.0.0.1
Address:	127.0.0.1#53

www.opensharing.priv	canonical name = wp-test.opensharing.priv.
Name:	wp-test.opensharing.priv
Address: 192.168.1.14

 

Requête inversée

nslookup 192.168.1.14

ex :

# nslookup 192.168.1.14
Server:		127.0.0.1
Address:	127.0.0.1#53

14.1.168.192.in-addr.arpa	name = www.opensharing.priv.

 

Consulter un serveur DNS particulier pour la requête

nslookup www.opensharing.priv dns1.opensharing.priv

ex :

# nslookup www.opensharing.priv dns1.opensharing.priv
Server:		dns1.opensharing.priv
Address:	192.168.1.11#53

www.opensharing.priv	canonical name = wp-test.opensharing.priv.
Name:	wp-test.opensharing.priv
Address: 192.168.1.14

 

Consulter les enregistrements de type Mail eXchanger (serveurs de messagerie)

nslookup -query=mx opensharing.priv

ex :

# nslookup -query=mx opensharing.priv
Server:		127.0.0.1
Address:	127.0.0.1#53

opensharing.priv	mail exchanger = 10 mail1-test.opensharing.priv.
opensharing.priv	mail exchanger = 20 mail2-test.opensharing.priv.

 

Consulter tous les types d’enregistrements pour un domaine

nslookup -query=any opensharing.priv

ex :

# nslookup -query=any opensharing.priv
Server:		127.0.0.1
Address:	127.0.0.1#53

opensharing.priv
	origin = dns1-test.opensharing.priv
	mail addr = adminsys.opensharing.priv
	serial = 2016061902
	refresh = 21600
	retry = 3600
	expire = 604800
	minimum = 86400
opensharing.priv	nameserver = dns1-test.opensharing.priv.
opensharing.priv	nameserver = dns2-test.opensharing.priv.
opensharing.priv	mail exchanger = 20 mail2-test.opensharing.priv.
opensharing.priv	mail exchanger = 10 mail1-test.opensharing.priv.
Name:	opensharing.priv
Address: 192.168.1.14

 

Consulter les enregistrements de type NameServer NS pour un domaine

nslookup -query=ns opensharing.priv

ex :

# nslookup -query=ns opensharing.priv
Server:		127.0.0.1
Address:	127.0.0.1#53

opensharing.priv	nameserver = dns2-test.opensharing.priv.
opensharing.priv	nameserver = dns1-test.opensharing.priv.

 

Consulter le SOA d’un domaine

nslookup -query=soa opensharing.priv

ex :

# nslookup -query=soa opensharing.priv
Server:		127.0.0.1
Address:	127.0.0.1#53

opensharing.priv
	origin = dns1-test.opensharing.priv
	mail addr = adminsys.opensharing.priv
	serial = 2016061902
	refresh = 21600
	retry = 3600
	expire = 604800
	minimum = 86400

 

Faire une requête en mode debug et verbeux

nslookup -debug www.opensharing.priv

ex :

# nslookup -debug www.opensharing.priv
Server:		127.0.0.1
Address:	127.0.0.1#53

------------
    QUESTIONS:
	www.opensharing.priv, type = A, class = IN
    ANSWERS:
    ->  www.opensharing.priv
	canonical name = wp-test.opensharing.priv.
	ttl = 86400
    ->  wp-test.opensharing.priv
	internet address = 192.168.1.14
	ttl = 86400
    AUTHORITY RECORDS:
    ->  opensharing.priv
	nameserver = dns1-test.opensharing.priv.
	ttl = 86400
    ->  opensharing.priv
	nameserver = dns2-test.opensharing.priv.
	ttl = 86400
    ADDITIONAL RECORDS:
    ->  dns1-test.opensharing.priv
	internet address = 192.168.1.11
	ttl = 86400
    ->  dns2-test.opensharing.priv
	internet address = 192.168.1.12
	ttl = 86400
------------
www.opensharing.priv	canonical name = wp-test.opensharing.priv.
Name:	wp-test.opensharing.priv
Address: 192.168.1.14

 

Préciser le port de la requête DNS (par défaut 53)

nslookup -port=53 www.opensharing.priv

ex :

# nslookup -port=53 www.opensharing.priv
Server:		127.0.0.1
Address:	127.0.0.1#53

www.opensharing.priv	canonical name = wp-test.opensharing.priv.
Name:	wp-test.opensharing.priv
Address: 192.168.1.14
Fermer le menu
%d blogueurs aiment cette page :