Hi guys, I would like to know how to make a script to check if ppp-out1 interfaces’s ip falls in an ip range which is, the first octet
must be 10, second octet 43 , third octet greater than 128 .. eg 10.43.129.23
If ip addres of ppp-out1 falls within the range then
script should exit
but if ip addres of ppp-out1 doesnt fall within the range then script should execute the command
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.
just a single interface like ppp-out1 and checks if its ip is in the range 10.43… with the 3rd octet greater than 128
and will execute a command if its in the range or isnt
Thanks