When I was working with pis on the wired network, the technical staff would configure them with a static ip, which made them easy to contact when running in headless mode. But the Makerspace doesn't have wired eithernet and, even when it will, it will probably use the campus services, which generally do dynamic addressing. So I'd like a Pi to report what address it's on to a central location so I can track it. I've adapted some PHP code on the server side to receive and report these data.
You need to set the hostname on the pi and then I've crafted this one-line liner to add to rc.local that, if the network is configured, will report it's IP address.
/usr/bin/wget -O/dev/null -q https://bcrc.bio.umass.edu/pitrack/?pi=`hostname`\&ip=$_IP
Just add inside the test that prints the IP address and done.
- Steven D. Brewer's blog
- Log in to post comments