dig: Difference between revisions
From Leechfinger
Jump to navigationJump to search
Line 33: | Line 33: | ||
;; ANSWER SECTION: | ;; ANSWER SECTION: | ||
amazon.com. 842 IN A 205.251.242.103 | amazon.com. 842 IN A 205.251.242.103 | ||
$ dig google.com +short | |||
142.250.113.102 | |||
142.250.113.101 | |||
142.250.113.100 | |||
142.250.113.113 | |||
142.250.113.139 | |||
142.250.113.138 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Look at the "ANSWER SECTION", it has name, TTL in seconds, IN (class or internet), A (record type), IP. | Look at the "ANSWER SECTION", it has name, TTL in seconds, IN (class or internet), A (record type), IP. | ||
=== Specify an exact DNS to search === | === Specify an exact DNS to search === | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> |
Revision as of 16:53, 16 May 2025
Install dig package
Dig is part of package bind9-dnsutils.
$ apt-file list bind9-dnsutils
bind9-dnsutils: /usr/bin/delv
bind9-dnsutils: /usr/bin/dig
bind9-dnsutils: /usr/bin/dnstap-read
bind9-dnsutils: /usr/bin/mdig
bind9-dnsutils: /usr/bin/nslookup
bind9-dnsutils: /usr/bin/nsupdate
bind9-dnsutils: /usr/share/doc/bind9-dnsutils/changelog.Debian.gz
bind9-dnsutils: /usr/share/doc/bind9-dnsutils/copyright
bind9-dnsutils: /usr/share/man/man1/delv.1.gz
bind9-dnsutils: /usr/share/man/man1/dig.1.gz
bind9-dnsutils: /usr/share/man/man1/dnstap-read.1.gz
bind9-dnsutils: /usr/share/man/man1/mdig.1.gz
bind9-dnsutils: /usr/share/man/man1/nslookup.1.gz
bind9-dnsutils: /usr/share/man/man1/nsupdate.1.gz
$ apt install bind9-dnsutils
Reverse lookup
This option sets simplified reverse lookups, for mapping addresses to names.
$ dig -x 54.239.28.85
Check dig version
$ dig -v
Find the ip of a host
$ dig amazon.com | grep -A 1 --color 'ANSWER SECTION'
;; ANSWER SECTION:
amazon.com. 842 IN A 205.251.242.103
$ dig google.com +short
142.250.113.102
142.250.113.101
142.250.113.100
142.250.113.113
142.250.113.139
142.250.113.138
Look at the "ANSWER SECTION", it has name, TTL in seconds, IN (class or internet), A (record type), IP.
Specify an exact DNS to search
$ dig @8.8.8.8 amazon.com
List all DNS of a host
$ dig google.com A +nssearch
SOA ns1.google.com. dns-admin.google.com. 759020131 900 900 1800 60 from server 216.239.38.10 in 28 ms.
SOA ns1.google.com. dns-admin.google.com. 759020131 900 900 1800 60 from server 216.239.32.10 in 28 ms.
SOA ns1.google.com. dns-admin.google.com. 759020131 900 900 1800 60 from server 216.239.36.10 in 44 ms.
SOA ns1.google.com. dns-admin.google.com. 759020131 900 900 1800 60 from server 216.239.34.10 in 52 ms.