Getting the current IP address from the Fonera Box

I wrote a little script to get the current public IP address from the Fonera status page. In my set up the box has the default internal IP address

Here the full script:



IP_ADDRESS=wget -q -O - | grep "IP Address" | sed -n '/<td>/{p;q;}' | sed 's/.*<td>//' | sed 's/</td></tr>//'

IP Address:

if test "cat /tmp/current-fonera-ip.txt" = "$IP_ADDRESS"; then
echo "not changed"
echo "changed, update"
# do something like dyndns update
wget -q http://user:password@server/nic/update?hostname=hostname.domain.tld
echo $IP_ADDRESS > /tmp/current-fonera-ip.txt

(As you see I used it to do a dyndns compatible update. On the server backend this just requires a bind configuration and a simple update script. Maybe I will show that later here.)

User login

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
17 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
Powered by Drupal