Thứ Năm, 28 tháng 11, 2013

DNS Lookup Command

DNS Lookup Command

How do I perform dns lookup under Linux or UNIX or Apple OS X operating systems without using 3rd party web sites for troubleshooting DNS usage?
You can use any one of the following dns lookup utility under Linux / UNIX. You can skip all 3rd party websites and use the following to debug your dns servers and lookup issues:

[a] host command - DNS lookup utility.
[b] dig command - DNS lookup utility.

Both commands will allow you to get answer to various dns queries such as the IP address (A), mail exchanges (MX), name servers (NS), text annotations (TXT), or ANY (all) type.

host DNS Lookup Examples

host command is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa. When no arguments or options are given, host command displays a short summary of its command line arguments and options. The syntax is as follows:
#host example.com
#host -t TYPE example.com
#host -t a example.com
Task: Find Out the Domain IP
$ host -t a example.com
Sample outputs:
example.com has address 75.126.153.x
Task: Find Out the Domain Mail Server
$ host -t mx example.com
Task: Find Out the Domain Name Servers
$ host -t ns example.com
Sample outputs:
Task: Find Out the Domain TXT Recored (e.g., SPF)
$ host -t txt example.com
Task: Find Out the Domain CNAME Record
$ host -t cname files. example.com
Task: Find Out the Domain SOA Record
 $ host -t soa example.com
Task: Query Particular Name Server
Query ns2.example.net:
$ host example.com ns2.example.net
Task: Display All Information About Domain Records and Zone
$ host -a example.com
OR
$ host -t any example.com
Task: Use IPv6 Query Transport
Test your dns lookup using IPv6 query transport (you must have IPV6 based connectivity including IPv6 enabled resolving name servers):
$ host -6 example.com
$ host -6 -a example.com
$ host -6 example.com ns1.example.net
$ host -6 -t ns example.com ns1.example.net
Task: Reverse IP Lookup
Type the command:
$ host {IP-Address-Here}
$ host 75.126.153.200
Task: Get TTL Information
Type the command as follows:
$ host -v -t {TYPE} {example.com}
$ host -v -t a example.com
$ host -v -t a i.hexindia.net
If you run the same command again, you’ll notice that the TTL number (1866) reduced.

dig DNS Lookup Examples

dig (domain information groper) or host command is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. hos dns lookup tool have less functionality than dig.

Examples
dig @{ns1.example.com} {example.com}
dig @{ns1.example.com} {example.com} {TYPE}
dig example.com a
dig example.com mx
dig example.com ns
dig example.com txt
dig @ns1. example.net example.com a
Task: Trace Usage
See how domains are resolved using root servers i.e. turn on tracing of the delegation path from the root name servers for the name being looked up. When tracing is enabled, dig makes iterative queries to resolve the name being looked up. It will follow referrals from the root servers, showing the answer from each server that was used to resolve the lookup:
$ dig +trace example.com
Task: Get Only Short Answer
A quick way to just get the answer is to type the following command:
$ dig +short cyberciti.biz
Task: Display All Records
$ dig +noall +answer cyberciti.biz any
Task: Reverse IP Lookup
Type the following command:
$ dig -x +short {IP-Address-here}
$ dig -x 75.126.153.200 +short
Task: Find Domain SOA Record
$ dig +nssearch example.com
Task: Find Out TTL Value Using dig
$ dig +nocmd +noall +answer {TYPE} {example.com}
$ dig +nocmd +noall +answer a example.com

$ dig +nocmd +noall +answer a example.com

Không có nhận xét nào:

Đăng nhận xét