I'm new to scripting so if anyone could help me I would be very grateful
I am trying to accomplish the following:
run a script that checks if the ip on a pppoe interface changed
if it's the same, nothing to be done
if it is, check the network ip (the gateway) for example if the ip is 93.123.130.155 the network ip is 93.123.130.1
my isp set me on two ip ranges (for example 93.123.130.0/24 and 93.123.131.0/24) so I would like to change static routes accordingly, when the range changes I would like to disable a static route and enable another, and when it changes back, reverse them
I managed to get to this script reading the example scripts so can you please correct it:
:local inetinterface "pppoe isp"
:local sad0 "93.123.130.1
:local sad1 "93.123.131.1;
:if ([/interface get $inetinterface value-name=running]) do={
# Get the current IP on the interface
:local currentIP [/ip address get [find interface="$inetinterface" disabled=no] network]};
:log info $currentIP
:if ($currentIP=$sad1) do={:system script run "isp3"} else={:system script run "isp4"}
Many thanks!!