3 Jan, 2018

Checking the gateway address on the route

:log info "--- Checking gateway for PPTP interfaces across Ukrcom ---"

:local currentGatewayStorage [ /ip route get value-name=gateway number=1 ]
:local currentGatewayManufacture [ /ip route get value-name=gateway number=2 ]

:if ($currentGatewayStorage = "<pptp-storage>") do={
:log info ( "Gateway on connection pptp-storage is OK" )
} else={
[ /ip route set numbers=1 gateway=<pptp-storage> ]
:log info ( "+ Gateway on connection pptp-storage is changed to correct" )
}

:if ($currentGatewayManufacture = "<pptp-manufacture>") do={
:log info ( "Gateway on connection pptp-manufacture is OK" )
} else={ 
[ /ip route set numbers=2 gateway=<pptp-manufacture> ]
:log info ( "+ Gateway on connection pptp-manufacture is changed to correct" )
}

Leave a Reply

Your email address will not be published. Required fields are marked *