Community discussions

MikroTik App
 
flamingbox
just joined
Topic Author
Posts: 1
Joined: Tue Aug 14, 2018 7:59 am

disable a default route that have no routing-mark

Tue Aug 14, 2018 8:06 am

hi i have a piece of code like this :
/ip route disable [find dst-address=0.0.0.0/0 gateway=2.2.2.2]
but i dont want it to match the ones that are in a separate routing table. it ends up disabling all default route with 2.2.2.2 as gateway including the ones on different routing-mark/table.

what i have tried without success :
/ip route disable [find dst-address=0.0.0.0/0 gateway=2.2.2.2 routing-mark=""]
/ip route disable [find dst-address=0.0.0.0/0 gateway=2.2.2.2 routing-mark="main"]
please advise,
thanks.
 
berzins
just joined
Posts: 10
Joined: Thu Apr 05, 2018 2:46 pm

Re: disable a default route that have no routing-mark

Tue Aug 14, 2018 1:47 pm

This script should disable any route with a routing mark of your choice.

Just change the $routing-mark$ parameter.
[/ip route disable [/ip route find where dst-address=0.0.0.0/0 gateway=2.2.2.2 routing-mark="main"]];
[/ip route disable [/ip route find where dst-address=0.0.0.0/0 gateway=2.2.2.2 routing-mark~""]];

Note: the second line disables ALL routes with given dst-address and gateway.
 
User avatar
ericksetiawan
Trainer
Trainer
Posts: 10
Joined: Fri Nov 20, 2015 6:29 am
Location: localhost

Re: disable a default route that have no routing-mark

Tue Aug 21, 2018 8:17 am

You can try to use !routing-mark

Code: Select all

/ip route disable [find dst-address=0.0.0.0/0 gateway=2.2.2.2 !routing-mark]

Who is online

Users browsing this forum: Bing [Bot] and 22 guests