A hálózati problémák elhárítása során a Linux rendszergazdák egyik alapvető eszköze a dig (Domain Information Groper) parancs. Ez a parancssori segédprogram lehetővé teszi a DNS (Domain Name System) lekérdezések végrehajtását, és a lekérdezett DNS szerverek által visszaadott válaszok megjelenítését. Míg a DNS-kereső eszközök, mint az nslookup, is hasonló célt szolgálnak, a dig sokkal rugalmasabb és részletesebb kimenetet biztosít, ami nélkülözhetetlenné teszi a bonyolultabb hibakeresési feladatoknál.


Option Description

+short Provides a short answer to the query.

+noall +answer Displays only the answer section of the query.

+stats Displays statistics about the query.

+trace Traces the path from the root DNS servers to the authoritative servers for a domain.

+nocmd Omits the initial command line from the output.

+nssearch Performs an NS query for the specified domain and checks all listed name servers for consistency.

@server Queries the specified DNS server.

-t type Specifies the type of DNS record to query (e.g., A, MX).

-p port Uses the specified port number for the query (default is 53).

-q name Queries the specified domain name.

-k filename Specifies a TSIG key file for secure DNS queries.

+[no]question Controls the display of the question section of the query.

+[no]answer Controls the display of the answer section of the query.

+[no]authority Shows or hides the authority section.

+[no]additional Displays or hides the additional section.

+[no]comments Shows or hides the comments in the output.

+[no]stats Displays or hides the statistics.

+[no]ttl Controls the display of TTL values.

+[no]recurse Toggles recursion for the query.

Például, ha a google.com IP-címét (A rekord) szeretnéd lekérdezni, egyszerűen csak a következő parancsot kell kiadnod:


dig google.com

A dig alapértelmezésben az IPv4 (A) rekordot keresi, de megadható más rekordtípus is, mint például az MX (mail exchange) vagy az NS (névserver) rekord.


dig google.com MX


dig google.com NS

Fordított DNS-lekérdezés (-x)


A dig parancs képes fordított lekérdezést is végezni, ami azt jelenti, hogy egy IP-címhez tartozó domainnevet keres. Ehhez a -x opciót kell használni.


dig -x 8.8.8.8