What's the command to find the name of a computer given its IP address?
I always forget what this command is, but I know it exists in Windows and I assume it exists on the *nix command-line.
|
What's the command to find the name of a computer given its IP address? I always forget what this command is, but I know it exists in Windows and I assume it exists on the *nix command-line. |
||||
|
|
|
dig and host should be what you're looking for ;) http://www.unix.com/unix-dummies-questions-answers/9866-nslookup-linux.html EDIT : nslookup work too finally, I had a blank on that one and tought it wasn't available so I deleted my post lol :P More infos on nslookup command whether it seems to have been replace since a while now : http://linuxreviews.org/man/nslookup/ |
||||
|
|
|
on *nix you can use dig -x [address] |
|||
|
If you're using nslookup it's this (assuming 192.168.0.1 as the IP in question)
EDIT: Remember a reverse lookup only works if there is a PTR record created for the IP, and it's not guaranteed to return the hostname you're looking for. Completely depends on how DNS is configured and maintained in your situation. |
|||||||
|
|
I'm well aware that dig/host/nslookup are the standard tools for these, but I keep these around for testing the OS's resolution (essentially, to test nsswitch.conf is working correctly): gethostbyname:
gethostbyaddr:
example:
|
|||||||||
|
|
Well, some friendly person just wrote nslookup is the command, and he's right. It works on both Unix and Windows. Not sure why you deleted your answer, but you are correct sir. |
|||||||||
|
|
On Windows I got in to the habit of using:
as this will also reflect data from your |
|||
|
|
|
On most of the Linux systems that I am aware of you can use:
will work on the command line. Come to think of it, isn't nslookup available on Windows XP? |
|||
|
|
|
I prefer the command-line dig for Windows (available here: http://members.shaw.ca/nicholas.fong/dig/) to nslookup any day. If you have to test/administer DNS from a Windows workstation, grab this tool. Then:
...also, remember to add c:\dig to your path! |
|||
|
|