Community discussions

MikroTik App
 
parscon
newbie
Topic Author
Posts: 35
Joined: Mon Dec 02, 2013 4:17 pm

Change routes every 15 second

Sun May 17, 2015 7:44 pm

I need a script can ability to disable active routes for 15 second (that mean the routes that are not disable) and their comments start with "IP". This very important only apply for routes that their comment start with "IP" and routes my be active.

Route IP1
Route IP2
Route IP3
Route IP4
Route IP5
Route IP6
Route IP7
Route IP8
Route IP9
Route IP10
and in IP 10 after 15 second again start from IP 1 route

Note: I have another script that in IP route IP 10 automatically will enable active routes.

The reason of this script , our routes will be block every 20 second by Internet provider and for this reason we need change routes every 15 second.


I test it by hand and work very well but need script to this automatically .

Please help me on this subject , really i need this . Thanks for your time.
 
JJCinAZ
Member
Member
Posts: 475
Joined: Fri Oct 22, 2004 8:03 am
Location: Tucson, AZ

Re: Change routes every 15 second

Sun May 17, 2015 10:18 pm

Is this what you're looking for?
{
   :local routelist [/ip route find where (!disabled && comment~"^IP")]
   :if ([:len $routelist] > 0) do={
      :foreach i in $routelist do={/ip route disable $i}
      :delay 15s
      :foreach i in $routelist do={/ip route enable $i}
   }
}
The if-statement is somewhat unneeded but it skips the delay if there are no routes found.
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 2879
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Change routes every 15 second

Sun May 17, 2015 10:25 pm

our routes will be block every 20 second by Internet provider
Strange..what ISP does this ? Are we helping to prepare spam source ? ... I know that I have been helping earlier with this problem..
What does "block" means ? IP is deactivated or IP is "banned" ?
 
parscon
newbie
Topic Author
Posts: 35
Joined: Mon Dec 02, 2013 4:17 pm

Re: Change routes every 15 second

Sun May 17, 2015 10:36 pm

My Friend , it is not for Spam Source , you did not live in countries like China , Iran and ...
any way
in IPIP tunnel they firewall (government) will drop the connection if it is establish more than 20 second . all VPN all Tunnel is already Blocked !!!! So first think after that write your idea,

Dear JJCinAZ Thanks but it will disable all active route , i need disable one by one each 15 second.

Thanks for your help.
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 2879
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Change routes every 15 second

Sun May 17, 2015 10:43 pm

 
parscon
newbie
Topic Author
Posts: 35
Joined: Mon Dec 02, 2013 4:17 pm

Re: Change routes every 15 second

Sun May 17, 2015 10:46 pm

I need This for UDP , for example EOIP is open but UDP does not work on EOIP i need tunnel between 2 router can pass UDP . if help me on this script it will help me so much .
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 2879
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Change routes every 15 second

Mon May 18, 2015 12:11 am

{
   :local routelist [/ip route find where (!disabled && comment~"^IP")]
   :if ([:len $routelist] > 0) do={
      :foreach i in $routelist do={
        /ip route disable $i
        :delay 15s
        /ip route enable $i
      }
   }
}

Who is online

Users browsing this forum: No registered users and 17 guests