host, nslookup and dig command used to query Internet name servers interactively (DNS lookup utility). Any one of these command is normally use to convert names to IP addresses and vice versa. These utilities are real lifesaver when you want to troubleshoot problem.
By default, they query and use name server specified in /etc/resolve.conf file. For example, consider output nslookup (use default name server):
$ nslookup
Output:
>cyberciti.biz Server: ns9.san.yahoo.com. Address: 216.109.116.20#53 Name: cyberciti.biz Address: 68.142.234.46 Name: cyberciti.biz Address: 68.142.234.47 Name: cyberciti.biz Address: 68.142.234.44 Name: cyberciti.biz Address: 68.142.234.45
Now execute same command as follows:
$ nslookup - ns1.net4india.com
Output:
> cyberciti.biz Server: ns1.net4india.com Address: 202.71.129.33#53 Name: cyberciti.biz Address: 67.15.117.192
When the first argument is a hyphen (-) and the second argument is the Internet address of a name server, you are forcing to use a certain name server to nslookup command. This is handy to debug domain related problems. Simlarly you can force dig command to use a certain name server:
$ dig @ns1.net4india.com +qr cyberciti.biz
OR force host command to use a certain nameserver:
$ host cyberciti.biz ns1.net4india.com
See also:
- How do I setup as DNS client?
- How do I improve DNS performance on Linux/Windows Desktop?
- Consult man page of dig, host, and nslookup for more info.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop











{ 0 comments… add one now }