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):
>cyberciti.biz Server: ns9.san.yahoo.com. Address: 22.214.171.124#53 Name: cyberciti.biz Address: 126.96.36.199 Name: cyberciti.biz Address: 188.8.131.52 Name: cyberciti.biz Address: 184.108.40.206 Name: cyberciti.biz Address: 220.127.116.11
Now execute same command as follows:
$ nslookup – ns1.net4india.com
> cyberciti.biz Server: ns1.net4india.com Address: 18.104.22.168#53 Name: cyberciti.biz Address: 22.214.171.124
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
- 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.