Interface Checking Script

Take a look at this Return IP octet function.
With this you should be able to easily compare the octets you need.
The rest should be pretty easy.
And have a look at this script.
I love the way it is implemented, as it will only trigger on a change of your public IP - no need to be run every 10 seconds.

Cheers
-Chris