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 192.168.10.1.

Here the full script:

{{{

!/bin/sh

IP_ADDRESS=wget -q -O - http://192.168.10.1/cgi-bin/status.sh | grep "IP Address" | sed -n '/<td>/{p;q;}' | sed 's/.*<td>//' | sed 's/</td></tr>//'

IP Address:88.130.197.125

if test "cat /tmp/current-fonera-ip.txt" = "$IP_ADDRESS"; then
echo "not changed"
else
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
fi
}}}

(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

CAPTCHA
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