How to find IP address of a machine on network?

Charles Darwin darwinskernel at
Sat Jan 17 12:42:19 UTC 2009

On 16-Jan-09, at 10:07 PM, NoOp wrote:

> On 01/16/2009 06:27 PM, Charles Darwin wrote:
>> On 16-Jan-09, at 4:20 PM, NoOp wrote:
>>> Nmap done: 256 IP addresses (6 hosts up) scanned in 2.741 seconds
>> -bash-3.2$ uname -v && time dns-sd -B _ssh._tcp .
>> Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008;
>> root:xnu-1228.9.59~1/RELEASE_I386
>> Browsing for _ssh._tcp
>> Timestamp     A/R Flags if Domain                    Service
>> Type              Instance Name
>> 21:22:16.685  Add     2  1 local.
>> _ssh._tcp.                Ubermensch
>> ^C
>> real	0m0.799s
>> user	0m0.001s
>> sys	0m0.002s
>> It seems to me using nmap "for what we are trying to do here" is like
>> using an artillery shell to knock out a mosquito, don't you thinnk?
> No. As it doesn't work on my machine.
> 1. $ uname -v && time dns-sd -B _ssh._tcp .
> #1 SMP Thu Nov 27 18:44:42 UTC 2008
> bash: dns-sd: command not found
> real	0m0.274s
> user	0m0.200s
> sys	0m0.052s
> 2. The OP asked:
> <quote>
> I have just installed ubuntu onto a machine and have connected it to
> my LAN.  The router provides DHCP and the new machine is up and
> running on the network.

So here you do have physical access to the machine. To get your IP  
simply run:

ipconfig getifaddr en0	#for Ethernet
ipconfig getifaddr en1	#for Wireless

You can wrap either of them (or both) in a script and have the script  
send you an email with the IP(s). nmap to artillery shell for a  
mosquito analogy would still work here.

> How do I connect *to* the machine?  I need to know its IP address and,
> as there are a few devices which get their address by DHCP it's not at
> all obvious what the machine's address is.
> Eventually I will probably give it a fixed address (for this reason
> among others).
> </quote>
> and then stated:
> <quote>
> Quite right, so I have a machine that runs sshd and I want to connect
> to it and I know it's on the LAN but not its IP address.
> </quote>

Now this seems like a different scenario. This seems to me (although  
not quite clear) like you do NOT have physical access to the machine  
that you want to ssh into (this is what I mean by "what we are trying  
to do here" BTW) and dns-sd is way faster for that unless you can  
figure out how to run nmap super light so it can bit dns-sd which is  
not an easy task; Zeroconf is optimized for sending/receiving minimum  
number of packages for service discovery and now you want to beat that  
by simply tweaking the nmap which is designed to do much more and is  
not necessarily brief in what does; I say good luck with that. On the  
other hand, I think, if you can find a default utility on linux (which  
I'm pretty sure there is one but I just don't know it), or better yet  
*nix, that would do a quick service discovery, then you're on you're  
way to somewhere.

More information about the ubuntu-users mailing list