What is the difference between Linux command dig and nslookup?
I'm asking this because some things I'm having a hard time wrapping my head around, and I'd like to know for sure if there's any difference between the two.
dig is a DNS lookup utility whereas nslookup is used to communicate with the IP/DNS server for resolving names. While dig can be used to resolve IP addresses, it only supports A-record queries and queries for IPv4/6, but not MX or SRV. For the latter two, one would need to use nslookup, as stated by wietze.
What is the Unix version of nslookup?
This question came from our site for professional and enthusiast programmers.
If you read the other answers, you'll notice that there are a lot of suggestions for the tool to use (nslookup, host, dig, etc.). ?
David SchwartzJun 13 '11 at 13:59. 5
@DavidScha's answer is still the right one, but I'd like to add some more options: Robby JoeJul 15 '11 at 23:53. @RobbyJoe: thanks, I'll go with nslookup, although I'm not sure I can get by without also including dig. David SchwartzSep 5 '11 at 7:47. 9 Answers.
You could try ping. Ping -c 3 www.stackoverflow.com
Pings three times to see if www.com is alive.
It will also work with ip addresses (as long as they're valid) and with hostnames. To answer your question, the main difference between ping and nslookup is that nslookup only deals with DNS servers. So, you need to run it in server mode (nslookup -query=server).
Another difference is that ping can be used to test the latency between two machines, whereas nslookup cannot be used for this (nslookup uses its own internal protocol for this). Ping will only work if the server is up, if it isn't up, ping will just fail.
1
I think it's good to learn how to use ping and nslookup side by side. I like them both, and you learn how to use them both. Then you can use them to learn more about the internals of the protocols.
Gord ThompsonSep 5 '11 at 8:14. 9
@DavidScha: Thanks for the advice, but you're missing the point. What I want to know is which tool I should use to query DNS servers. (Or maybe I just want to know what all these tools do.
How to install nslookup in Linux?
So I was trying to install nslookup, but the installation is so long.
So I want to make some easier way to solve this problem? For example, I want to download nslookup and install it, just with that easy command line.
Can I get the installation guide by command line? Any information and/or instructions are greatly appreciated. In all versions, nslookup can be installed as a stand-alone program, or as part of the resolvconf package that provides dynamic DNS updating service. It's simple to tell how much has been done already. Here it's about 0.12 % of the total package size. That percentage might change between releases.10, it will take about 13KB, compared to about 100MB in the previous method. You don't need the "nslookup" meta-package any more; it appears that all these packages were merged into resolvconf, the resolver service itself.
So after I type those commands, I got that message:E: unable to locate package resolvconf. However, I followed the instruction still. Then I typed:sudo apt-get install nslookup. But it didn't work. I thought, maybe I was doing something wrong, so I tried once again:cdnsftp.com/downloadmirror/ubuntu/13.10/i386/nslookup7.71.250.2all.debsudo dpkg -i nslookup7.deblsedkpg -i nslookup7.deb then, it still didn't work.
Related Answers
How to install nslookup command in CentOS 7?
I mean to check the hostname, ip address. k1l...
What is the Linux version of nslookup?
Nslookup. nslookup is a command-line tool for querying the n...
How do I get nslookup on Linux?
Nslookup has a slew of different query modes that you can us...