Wednesday, 12 December 2012

Sleuthing the IP address of your Raspberry Pi

I like to control my Pi from my Mac by ssh'ing in once I know the IP address.

In order to get a faster experience, I used a crossover cable to connect to my Mac but I never knew how to detect the IP address the Pi uses.

The answer is in a great article my friend sent me:

You just have to look in the contents of /private/var/db/dhcpd_leases by typing:

$ cat /private/var/db/dhcpd_leases

This will give you something like:
{
name=my-iPhone
ip_address=10.5.2.3
hw_address=1,54:1f:aa:72:f:d1
identifier=1,58:1f:aa:72:f:d1
lease=0x5558429e
}

...then you just scroll down the list until you see the name raspberrypi and take a note of the IP address.

Here's the article:
Raspberry Pi-ing, MacGyver Style
I'm looking forward to trying to get internet sharing working across the crossover connection too when I get the time. (it failed miserably last time I tried)

UPDATE: I tried using a normal network cable instead of the crossover as the article describes and it all works seamlessly - I was able to set up internet sharing as well.

Be aware that typing $ cat /private/var/db/dhcpd_leases may give you command not found if it can't find anything. Just reboot the Pi and it should return the details.

No comments:

Post a Comment