This is how to get IP address information for a host. The host command is very useful for performing a DNS lookup.
homer@neo:~$ host yahoo.com yahoo.com has address 206.190.36.45 yahoo.com has address 98.139.183.24 yahoo.com has address 98.138.253.109 yahoo.com mail is handled by 1 mta5.am0.yahoodns.net. yahoo.com mail is handled by 1 mta7.am0.yahoodns.net. yahoo.com mail is handled by 1 mta6.am0.yahoodns.net. |
This is how to get the domain IP address.
homer@neo:~$ host -t a yahoo.com yahoo.com has address 98.139.183.24 yahoo.com has address 206.190.36.45 yahoo.com has address 98.138.253.109 |
Find out the domain mail server(s) with this command.
homer@neo:~$ host -t mx yahoo.com yahoo.com mail is handled by 1 mta5.am0.yahoodns.net. yahoo.com mail is handled by 1 mta7.am0.yahoodns.net. yahoo.com mail is handled by 1 mta6.am0.yahoodns.net. |
Find out the domain name servers for the address this way. Here is the output you should get.
homer@neo:~$ host -t ns yahoo.com yahoo.com name server ns1.yahoo.com. yahoo.com name server ns8.yahoo.com. yahoo.com name server ns4.yahoo.com. yahoo.com name server ns3.yahoo.com. yahoo.com name server ns6.yahoo.com. yahoo.com name server ns2.yahoo.com. yahoo.com name server ns5.yahoo.com. |
Get all pertinent information about a host this way. This gives you the host IP addresses and the name servers.
homer@neo:~$ host -a nsa.gov Trying "nsa.gov" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28754 ;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;nsa.gov. IN ANY ;; ANSWER SECTION: nsa.gov. 299 IN A 65.196.127.226 nsa.gov. 299 IN A 65.196.127.225 nsa.gov. 3599 IN MX 20 emvm-gh1-uea09.nsa.gov. nsa.gov. 3599 IN MX 20 emvm-gh1-uea08.nsa.gov. nsa.gov. 21599 IN NS dsdn-gh1-uea05.nsa.gov. nsa.gov. 21599 IN NS dsdn-gh1-uea06.nsa.gov. nsa.gov. 21599 IN SOA dsdn-gh1-uea05.nsa.gov. please_set_email.absolutely.nowhere. 2011061486 10800 3600 2419200 900 Received 248 bytes from 192.168.1.1#53 in 376 ms |
Reverse IP lookup with the host command.
homer@neo:~$ host 82.98.86.176
176.86.98.82.in-addr.arpa domain name pointer ironman3.com. |
To show how names are resolved using name servers, use the dig command with the +trace parameter to trace the path to the target.
homer@neo:~$ dig +trace yahoo.com ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> +trace yahoo.com ;; global options: +cmd . 5476 IN NS a.root-servers.net. . 5476 IN NS b.root-servers.net. . 5476 IN NS c.root-servers.net. . 5476 IN NS d.root-servers.net. . 5476 IN NS e.root-servers.net. . 5476 IN NS f.root-servers.net. . 5476 IN NS g.root-servers.net. . 5476 IN NS h.root-servers.net. . 5476 IN NS i.root-servers.net. . 5476 IN NS j.root-servers.net. . 5476 IN NS k.root-servers.net. . 5476 IN NS l.root-servers.net. . 5476 IN NS m.root-servers.net. ;; Received 228 bytes from 192.168.1.1#53(192.168.1.1) in 520 ms com. 172800 IN NS a.gtld-servers.net. com. 172800 IN NS b.gtld-servers.net. com. 172800 IN NS c.gtld-servers.net. com. 172800 IN NS d.gtld-servers.net. com. 172800 IN NS e.gtld-servers.net. com. 172800 IN NS f.gtld-servers.net. com. 172800 IN NS g.gtld-servers.net. com. 172800 IN NS h.gtld-servers.net. com. 172800 IN NS i.gtld-servers.net. com. 172800 IN NS j.gtld-servers.net. com. 172800 IN NS k.gtld-servers.net. com. 172800 IN NS l.gtld-servers.net. com. 172800 IN NS m.gtld-servers.net. ;; Received 487 bytes from 128.63.2.53#53(128.63.2.53) in 17306 ms yahoo.com. 172800 IN NS ns1.yahoo.com. yahoo.com. 172800 IN NS ns5.yahoo.com. yahoo.com. 172800 IN NS ns2.yahoo.com. yahoo.com. 172800 IN NS ns3.yahoo.com. yahoo.com. 172800 IN NS ns4.yahoo.com. ;; Received 197 bytes from 192.55.83.30#53(192.55.83.30) in 6259 ms yahoo.com. 1800 IN A 206.190.36.45 yahoo.com. 1800 IN A 98.139.183.24 yahoo.com. 1800 IN A 98.138.253.109 yahoo.com. 172800 IN NS ns6.yahoo.com. yahoo.com. 172800 IN NS ns8.yahoo.com. yahoo.com. 172800 IN NS ns1.yahoo.com. yahoo.com. 172800 IN NS ns2.yahoo.com. yahoo.com. 172800 IN NS ns3.yahoo.com. yahoo.com. 172800 IN NS ns4.yahoo.com. yahoo.com. 172800 IN NS ns5.yahoo.com. ;; Received 313 bytes from 68.142.255.16#53(68.142.255.16) in 171 ms |