Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Finding IP through terminal...

Finding IP through terminal...
Thread Tools
tomdavidson69
Forum Regular
Join Date: Jun 2003
Location: South of the border, UK
Status: Offline
Reply With Quote
Jan 18, 2004, 06:35 PM
 
I've got the problem (I think) where my window server crashes freezes the machine. I've heard that you can SSH into the box, kill window server and all is well once more...

Being not a particularly unix-y person it took me a while to discover SSH, I've now signed in from my girlf's ibook into my imac great.

The only thing is that I need to know my IP (of my malfuctioning iMac) to SSH in, because when I tried SSH [computer name] log on, I got prompted for a password and then it didn't work. When I tried user@ipaddress, it worked fine.

My problem is this, as we are on a DCHP router, I won't know my IP until I need, i.e. too late. So what (if any) terminal command can I use on my girlf's ibook to to get the IP of my imac?

Once into the iMac I run 'top' (right?) get the PID, then do something like 'kill [PID]'... would that solve it??

Many thanks for any help and sorry for the lengthy introduction to a simple problem!!
"I'm Captain Chaos! Been in the force long...?"
     
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Jan 18, 2004, 06:45 PM
 
ifconfig -a

Gives your the configuration of all your network interfaces (including IP addresses).
     
tomdavidson69  (op)
Forum Regular
Join Date: Jun 2003
Location: South of the border, UK
Status: Offline
Reply With Quote
Jan 18, 2004, 06:51 PM
 
Thanks for that, but unless I'm mistaken that gives the IP for the Local machine. I need the address of my imac on the network (which has frozen), then I can ssh in!

Cheers..
"I'm Captain Chaos! Been in the force long...?"
     
Art Vandelay
Professional Poster
Join Date: Sep 2002
Location: New York, NY
Status: Offline
Reply With Quote
Jan 18, 2004, 06:54 PM
 
You can use the Rendezvous name.

ssh [email protected]

Of course, this only works on an OS that supports Rendezvous, such as OS X.
Vandelay Industries
     
tomdavidson69  (op)
Forum Regular
Join Date: Jun 2003
Location: South of the border, UK
Status: Offline
Reply With Quote
Jan 18, 2004, 07:01 PM
 
Originally posted by Art Vandelay:
You can use the Rendezvous name.

ssh [email protected]l

Of course, this only works on an OS that supports Rendezvous, such as OS X.
Works like a charm, thanks!
"I'm Captain Chaos! Been in the force long...?"
     
andrew davidoff
Junior Member
Join Date: Nov 2003
Status: Offline
Reply With Quote
Jan 20, 2004, 06:24 PM
 
in case you're ever in a situation where that isn't going to work, here's another option...

you can ping the broadcast address for your network to populate your arp cache, then dump your arp cache and look for the mac address you're seeking.

so for example, if you were in RFC1918 space on the network 192.168.1.0 and your netmask was 255.255.255.0 and you were looking for the IP of the device with macaddress 00:00:00:11:11:11, you could

ping 192.168.1.255

wait for replies

then arp -an | grep "00:00:00:11:11:11"

or don't grep it out and look through the dump yourself (should be small if you're not on a corporate lan or anything.

this won't always work, more specifically in corporate environments depending on certain configurations than a home config, but it's always worth a try.

also if you're on a dhcp router you have access to you should be able to look at its dhcp clients table. even easier :-)

just throwing it out there...

andrew davidoff
     
kaboom
Forum Regular
Join Date: Jan 2001
Status: Offline
Reply With Quote
Jan 21, 2004, 01:18 PM
 
ifconfig | grep 'broadcast' | awk '{print $6}'
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 11:18 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,