Page 1 of 1

enable/disable route script

Posted: Tue Dec 11, 2007 11:25 am
by lamersons
hi m8s

Im new to scripting so give a break 8)
i need to make script that enables/disables route

Script: ip route {print}{disable 0}
It should disable route0 but it doesn’t. When I do it from command line it disables it, but as soon as I enter it into script source window it fails me. What do I do wrong ?

For example
Script: ip route add dst-address=x.x.x.x/x gateway=x.x.x.x
Works fine for me both command line and script source window.

using 2.9.46

Re: enable/disable route script

Posted: Tue Dec 11, 2007 12:04 pm
by mrz
search the forum, this was asked so many times.

print then disable {number} doesn't work when used in scripts.
Please read the manual how to use find commad:
http://www.mikrotik.com/testdocs/ros/2. ... 9330088749

Re: enable/disable route script

Posted: Wed Dec 12, 2007 12:01 pm
by lamersons
in any case support have sent me the solution if any1 else needs 8)

---
It is not possible to use number of rule in scripts.
Because print is required before, it is not possible to run print in script.

So to make your script working, add comment to script like comment=gateway1, Then use the following script,

'ip route disable [find comment=gateway1]'
---

Re: enable/disable route script

Posted: Mon Dec 17, 2007 6:16 pm
by kuppavenkatakrishna
Hi,

Can you send me the script to my id kvkrisshna@yahoo.com

My actual necessity is
I have two ISPs connected to my mikrotik router both connected on ethernet Please find the diagram attached and due to the network design the failover does not happen for which i need a script which will disable the primary gateway (Point to Point IP of first ISP on ISP End) and should enable the secondary default route.

Help from anyone is appreciated.

Regards,
K.V.Krisshna

Re: enable/disable route script

Posted: Tue Dec 18, 2007 6:03 am
by ashish
Contact
http://www.mikrotik.com/consultants.html#country_India
Hi,

Can you send me the script to my id kvkrisshna@yahoo.com

My actual necessity is
I have two ISPs connected to my mikrotik router both connected on ethernet Please find the diagram attached and due to the network design the failover does not happen for which i need a script which will disable the primary gateway (Point to Point IP of first ISP on ISP End) and should enable the secondary default route.

Help from anyone is appreciated.

Regards,
K.V.Krisshna

Re: enable/disable route script

Posted: Sat Jun 06, 2009 11:17 am
by mikman
Great Guys
You really solved my problem with enable/disable routes.

many thanks to lamerous

Appreciate it...

Mikman