rem_lex

probe-gw-maximus

Jan 1st, 2023
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | Source Code | 0 0
  1. :local probeIP "77.88.8.8";
  2. :local probeMARK "to-maximus-test";
  3. :local routeCOM "maximus";
  4.  
  5. :local p [ping $probeIP routing-table=$probeMARK count=5]; :put $p;
  6.  
  7. # if ping failed and route is not disabled, disable it
  8. local crd [:len [/ip route find where comment=$routeCOM disabled=no]];
  9. :if ($p = 0 && $crd > 0 ) do={
  10. /log error "Routing via R marked as $probeMARK - is fail! Disabling route!";
  11. /ip route disable [find where comment=$routeCOM];
  12. }
  13. # if ping succeeded and route is not enabled, enable it
  14. local cre [:len [/ip route find where comment=$routeCOM disabled=yes]];
  15. :if ($p = 5 && $cre > 0 ) do={
  16. /log error "Routing via R marked as $probeMARK - is success! Enabling route!";
  17. /ip route enable [find where comment=$routeCOM];
  18. }
  19.  
Tags: mikrotik
Advertisement
Add Comment
Please, Sign In to add comment