Commandes Linux : host

HOST

Installé avec le paquet bind9-host
Voir aussi : nslookup et dig.

 

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 host

apt-cache policy bind9-host

 

Requêter l’adresse IP d’un hôte particulier (enregistrement de type A)

host www.opensharing.priv

ex :

# host www.opensharing.priv
www.opensharing.priv is an alias for wp-test.opensharing.priv.
wp-test.opensharing.priv has address 192.168.1.14

 

Forcer le résultat de la requête précédente en IPv4

host -4 www.opensharing.priv

 

Requêter l’ensemble des enregistrements autorisés d’un domaine (sans transfert de zone)

host -a opensharing.priv

ex :

# host -a opensharing.priv
Trying "opensharing.priv"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47615
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 4

;; QUESTION SECTION:
;opensharing.priv.		IN	ANY

;; ANSWER SECTION:
opensharing.priv.	86400	IN	SOA	dns1-test.opensharing.priv. adminsys.opensharing.priv. 2016061902 21600 3600 604800 86400
opensharing.priv.	86400	IN	NS	dns1-test.opensharing.priv.
opensharing.priv.	86400	IN	NS	dns2-test.opensharing.priv.
opensharing.priv.	86400	IN	MX	10 mail1-test.opensharing.priv.
opensharing.priv.	86400	IN	MX	20 mail2-test.opensharing.priv.
opensharing.priv.	86400	IN	A	192.168.1.14

;; ADDITIONAL SECTION:
dns1-test.opensharing.priv. 86400 IN	A	192.168.1.11
dns2-test.opensharing.priv. 86400 IN	A	192.168.1.12
mail1-test.opensharing.priv. 86400 IN	A	192.168.1.15
mail2-test.opensharing.priv. 86400 IN	A	192.168.1.16

Received 261 bytes from 127.0.0.1#53 in 0 ms

ou, en mode verbeux :

host -av opensharing.priv

Equivaut à :
dig ANY opensharing.priv
 

Requêter l’ensemble des enregistrements d’un domaine (si le transfert de zone est autorisé)

host -al opensharing.priv

ou

host -t AXFR opensharing.priv

ex :

# host -al opensharing.priv
Trying "opensharing.priv"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29917
;; flags: qr aa ra; QUERY: 1, ANSWER: 20, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;opensharing.priv.		IN	AXFR

;; ANSWER SECTION:
opensharing.priv.	86400	IN	SOA	dns1-test.opensharing.priv. adminsys.opensharing.priv. 2016061902 21600 3600 604800 86400
opensharing.priv.	86400	IN	NS	dns1-test.opensharing.priv.
opensharing.priv.	86400	IN	NS	dns2-test.opensharing.priv.
opensharing.priv.	86400	IN	MX	10 mail1-test.opensharing.priv.
opensharing.priv.	86400	IN	MX	20 mail2-test.opensharing.priv.
opensharing.priv.	86400	IN	A	192.168.1.14
dhcp1.opensharing.priv.	86400	IN	CNAME	dns1-test.opensharing.priv.
dns1.opensharing.priv.	86400	IN	CNAME	dns1-test.opensharing.priv.
dns1-test.opensharing.priv. 86400 IN	A	192.168.1.11
dns2.opensharing.priv.	86400	IN	CNAME	dns2-test.opensharing.priv.
dns2-test.opensharing.priv. 86400 IN	A	192.168.1.12
mail1.opensharing.priv.	86400	IN	CNAME	mail1-test.opensharing.priv.
mail1-test.opensharing.priv. 86400 IN	A	192.168.1.15
mail2.opensharing.priv.	86400	IN	CNAME	mail2-test.opensharing.priv.
mail2-test.opensharing.priv. 86400 IN	A	192.168.1.16
opsi.opensharing.priv.	86400	IN	CNAME	opsi-test.opensharing.priv.
opsi-test.opensharing.priv. 86400 IN	A	192.168.1.13
wp-test.opensharing.priv. 86400	IN	A	192.168.1.14
www.opensharing.priv.	86400	IN	CNAME	wp-test.opensharing.priv.
opensharing.priv.	86400	IN	SOA	dns1-test.opensharing.priv. adminsys.opensharing.priv. 2016061902 21600 3600 604800 86400

Equivaut à :
dig AXFR opensharing.priv
 

Requête d’un enregistrement inversé (enregistrement de type PTR)

host 192.168.1.14

ex :

# host 192.168.1.14
14.1.168.192.in-addr.arpa domain name pointer www.opensharing.priv.

 

Requête de l’enregistrement de type A d’un domaine (par défaut)

host -t A opensharing.priv

ex :

# host -t A opensharing.priv
opensharing.priv has address 192.168.1.14

 

Requête des enregistrements de type NS d’un domaine

host -t NS opensharing.priv

ex :

# host -t NS opensharing.priv
opensharing.priv name server dns1-test.opensharing.priv.
opensharing.priv name server dns2-test.opensharing.priv.

 

Requête des enregistrements de type MX d’un domaine

host -t MX opensharing.priv

ex :

# host -t MX opensharing.priv
opensharing.priv mail is handled by 10 mail1-test.opensharing.priv.
opensharing.priv mail is handled by 20 mail2-test.opensharing.priv.

 

Requête des enregistrements de type CNAME d’un hôte

host -t CNAME www.opensharing.priv

ex :

# host -t CNAME www.opensharing.priv
www.opensharing.priv is an alias for wp-test.opensharing.priv.

 

Requête des enregistrements de type SOA d’un domaine

host -t SOA opensharing.priv

ex :

# host -t SOA opensharing.priv
opensharing.priv has SOA record dns1-test.opensharing.priv. adminsys.opensharing.priv. 2016061902 21600 3600 604800 86400

 

Afficher l’enregistrement SOA des serveurs autoritaires d’un domaine

host -C opensharing.priv

pour la zone de recherche directe
ex :

# host -C opensharing.priv
Nameserver 192.168.1.11:
	opensharing.priv has SOA record dns1-test.opensharing.priv. adminsys.opensharing.priv. 2016061902 21600 3600 604800 86400
Nameserver 192.168.1.12:
	opensharing.priv has SOA record dns1-test.opensharing.priv. adminsys.opensharing.priv. 2016061902 21600 3600 604800 86400
host -C 1.168.192.in-addr.arpa

pour la zone de recherche inversée
ex :

# host -C 1.168.192.in-addr.arpa
Nameserver 192.168.1.11:
	1.168.192.in-addr.arpa has SOA record dns1-test.opensharing.priv. adminsys.opensharing.priv. 2016061902 21600 3600 604800 86400
Nameserver 192.168.1.12:
	1.168.192.in-addr.arpa has SOA record dns1-test.opensharing.priv. adminsys.opensharing.priv. 2016061902 21600 3600 604800 86400

 

Requêter un serveur de nom particulier

host www.opensharing.priv dns1.opensharing.priv

ex :

# host www.opensharing.priv dns1.opensharing.priv
Using domain server:
Name: dns1.opensharing.priv
Address: 192.168.1.11#53
Aliases: 

www.opensharing.priv is an alias for wp-test.opensharing.priv.
wp-test.opensharing.priv has address 192.168.1.14
Fermer le menu
%d blogueurs aiment cette page :