Query Internet name servers with a certain DNS server

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:


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum