ELSE
April 20, 2010, 7:30am
1
Hello!
I have the 3-lines script:
/ip route set [/ip route find dst-address=“0.0.0.0/0”] gateway=“xxx.xxx.xxx.xxx”
/routing bgp peer set [/routing bgp peer find name=“ISP1”] out-filter=“”
/routing bgp peer set [/routing bgp peer find name=“ISP2”] out-filter=“OUT_OFF”
I entered it via Winbox in System-Scripts
When I run the script only first line is executed. Other lines are not worked.
I use “;” and different NEWLINES as wrote in manual but in all cases only first line of my script is executed.
Why?
Open and close brackets before and after the commands
{
/ip route set [/ip route find dst-address="0.0.0.0/0"] gateway="xxx.xxx.xxx.xxx";
/routing bgp peer set [/routing bgp peer find name="ISP1"] out-filter="";
/routing bgp peer set [/routing bgp peer find name="ISP2"] out-filter="OUT_OFF";
}
The braces are not required, they are optional.
Try this code:
:put ("start script")
:put ("exec: /ip route set")
/ip route set [/ip route find dst-address="0.0.0.0/0"] gateway="xxx.xxx.xxx.xxx"
:put ("exec: /routing bgp peer set for ISP1")
/routing bgp peer set [/routing bgp peer find name="ISP1"] out-filter=""
:put ("exec: /routing bgp peer set for ISP2")
/routing bgp peer set [/routing bgp peer find name="ISP2"] out-filter="OUT_OFF"
:put ("end script")
The output should be:
start script
exec: /ip route set
exec: /routing bgp peer set for ISP1
exec: /routing bgp peer set for ISP2
end script
This means all commands are getting executed. Most likely, all lines are getting executed, but the embedded find commands are failing to find entries.
ELSE
April 20, 2010, 12:08pm
4
OK. I have found the trouble.
I have 3 routes in route tables - one of them is static, other are got dynamically from BGP neighbors.
When the first line is executed - the error (or warning) about cannot modify dynamic routes is appeared. After this error (or warning) execution of full script stopped.
I inserted comment “default” and now RouterOS find the right only one route throw comment field.
Thank you for helping!!!