Monday, March 25, 2013

Find my pi

Now that I've got the pi up and running, I don't necessarily want to plug it in to keyboards and mice and monitors all the time... it's easier just to feed it 5V and log in from the laptop via ssh which is what I'm doing right now.

I've been doing this by using a broadcast ping from my Mac terminal app.  This just involves pinging the whole subnet by setting (typically) the last byte of the ping target to 255 (all bits = 1).  

Then you get responses from all devices on your local area network.  Unfortunately you have to try them all until you find the right one.  On my home network it tends to always get the same address (192.168.1.124) which is handy.

To enable broadcast ping, you can use this script:

echo '..'

echo '# Disable ignore broadcast request'
echo 'net.ipv4.icmp_echo_ignore_broadcasts = 0'

read -n1

sudo nano /etc/sysctl.conf

Adding the second echo line (sans quotes, echo) to your /etc/sysctl.conf will enable broadcast ping.

Detecting the pi automatically on the network is one of the problems I plan to tackle.  Being able to connect to it with minimal fanfare no matter where I am is a goal.





No comments:

Post a Comment