Dig
From Linuxintro
Revision as of 10:54, 14 June 2019 by imported>ThorstenStaerk
The command dig allows you to query a name server for IP addresses like this:
# dig www.linuxintro.org ; <<>> DiG 9.7.3-P1 <<>> www.linuxintro.org ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 884 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.linuxintro.org. IN A ;; ANSWER SECTION: www.linuxintro.org. 14400 IN A 92.51.132.237 ;; Query time: 67 msec ;; SERVER: 192.168.0.1#53(192.168.0.1) ;; WHEN: Sat Jul 2 14:34:22 2011 ;; MSG SIZE rcvd: 52
In this example we see the IP address of www.linuxintro.org is 92.51.132.237.
The syntax of a dig call is
dig @dnsserver domain type
for example
- query the 192.168.0.1 for the IP address of the hostname bartholomeus
dig @192.168.0.1 bartholomeus
- query for the mail record (MX) of staerk.de
root@mail:~# dig staerk.de MX ; <<>> DiG 9.9.5-3ubuntu0.5-Ubuntu <<>> staerk.de MX ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55597 ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 2, ADDITIONAL: 6 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 1480 ;; QUESTION SECTION: ;staerk.de. IN MX ;; ANSWER SECTION: staerk.de. 3536 IN MX 1 aspmx.l.google.com.staerk.de. staerk.de. 3536 IN MX 5 alt2.aspmx.l.google.com.staerk.de. staerk.de. 3536 IN MX 5 alt1.aspmx.l.google.com.staerk.de. staerk.de. 3536 IN MX 10 alt4.aspmx.l.google.com.staerk.de. staerk.de. 3536 IN MX 10 alt3.aspmx.l.google.com.staerk.de.