Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a list of computer names that I would like to be able to know the IP address of to RDP/VNC from time to time.

I was wondering if there was a way I could look them up? I am using a Mac but the normal

ping PCNAME

doesn't seem to work. Is there an alternative?

share|improve this question

3 Answers 3

up vote 2 down vote accepted
dig hostname

will work on mac to find out IP address, that assumes that your local network dns configuration has the correct results or it exists in global dns

share|improve this answer
1  
Additionally, if you want just the IP address without all the other information, dig hostname +short will get you that. If you're on the same local LAN as the hosts and they have Bonjour/ZeroConf names set, you can use dig computer-name.local +short to get the IPs, even if they don't have DNS entries. –  morgant Jul 21 '11 at 11:11

Try this to resolve names from the DNS:

nslookup PCNAME
hostx PCNAME
host PCNAME
dig PCNAME

One of these should work. If it returns no answer it means your administrator did not configure DNS for them. Then it depends of these are Macs or PCs with Windows.

share|improve this answer

Try

sudo arp-scan -I eth0 -l | perl -ne '/((\d{1,3}.){3}\d{1,3})/ and $ip=$1 and $_=nmblookup -A $ip and /([[:alnum:]-]+)\s+<00>[^<]+/m and printf "%15s %s\n",$ip,$1'

Hope that helps

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.