Routing filter order
Posted: Tue Jul 04, 2017 2:07 pm
Hi
So if I understood this correctly the routing filters are processed from top to bottom in the same chain. Each rule in the filters has a rule number.
Example, routing filter print.
0 chain=IPV4-TRANSIT-IN invert-match=no action=accept set-bgp-local-pref=100 set-bgp-prepend-path="" set-bgp-med=5000
1 chain=IPV4-TRANSIT-IN invert-match=no action=discard set-bgp-prepend-path=""
2 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-as-path=^$ invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
3 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-communities=41281:9000 invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
4 chain=IPV4-TRANSIT-OUT invert-match=no action=discard set-bgp-prepend-path=""
---
What is the purpose of this rule number? Since it obviously has nothing to do with the actual order of the rules being interpreted.
I can for example move rule #2 IPV4-TRANSIT-OUT to be first like this,
0 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-as-path=^$ invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
1 chain=IPV4-TRANSIT-IN invert-match=no action=accept set-bgp-local-pref=100 set-bgp-prepend-path="" set-bgp-med=5000
2 chain=IPV4-TRANSIT-IN invert-match=no action=discard set-bgp-prepend-path=""
3 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-communities=41281:9000 invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
4 chain=IPV4-TRANSIT-OUT invert-match=no action=discard set-bgp-prepend-path=""
---
Which would make the whole thing very confusing when looking at.
So my questions are. Is there any difference in processeing when doing the above? When moving rules in a chain so it's not grouped together but keeping the same order?
If there is no difference then maybe Mikrotik should instead change/add so the assignment of a number to the rules are grouped per chain. Example ,
0 chain=IPV4-TRANSIT-IN invert-match=no action=accept set-bgp-local-pref=100 set-bgp-prepend-path="" set-bgp-med=5000
1 chain=IPV4-TRANSIT-IN invert-match=no action=discard set-bgp-prepend-path=""
0 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-as-path=^$ invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
1 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-communities=41281:9000 invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
2 chain=IPV4-TRANSIT-OUT invert-match=no action=discard set-bgp-prepend-path=""
--
Another example is if you print a single chain , routing filter print where chain=IPV4-TRANSIT-IN it will assign a number from 0 and up. Confirming that the rule number is just some incremental counter not really connected to the actual rule just to the output of the print.
What confuses everything more then is the following,
routing filter print where chain=IPV4-TRANSIT-OUT :
0 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-as-path=^$ invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
1 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-communities=41281:9000 invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
2 chain=IPV4-TRANSIT-OUT invert-match=no action=discard set-bgp-prepend-path=""
If I now want to move let's say rule #1 to be #0 I can't use the numbers provided in the output but I have to use the numbers provided when printing all the rules,
routing filter print :
0 chain=IPV4-TRANSIT-IN invert-match=no action=accept set-bgp-local-pref=100 set-bgp-prepend-path="" set-bgp-med=5000
1 chain=IPV4-TRANSIT-IN invert-match=no action=discard set-bgp-prepend-path=""
2 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-as-path=^$ invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
3 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-communities=41281:9000 invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
4 chain=IPV4-TRANSIT-OUT invert-match=no action=discard set-bgp-prepend-path=""
routing filter move numbers=3 destination=2
--
I'm sorry for the confusing post. I hope someone understands And either can say that i'm doing it wrong or that maybe mikrotik can assign a number to rules within their chain. Just like in for example cisco "route-map IPV4-TRANSIT-OUT permit 10", "permit 20" etc.
--
So if I understood this correctly the routing filters are processed from top to bottom in the same chain. Each rule in the filters has a rule number.
Example, routing filter print.
0 chain=IPV4-TRANSIT-IN invert-match=no action=accept set-bgp-local-pref=100 set-bgp-prepend-path="" set-bgp-med=5000
1 chain=IPV4-TRANSIT-IN invert-match=no action=discard set-bgp-prepend-path=""
2 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-as-path=^$ invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
3 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-communities=41281:9000 invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
4 chain=IPV4-TRANSIT-OUT invert-match=no action=discard set-bgp-prepend-path=""
---
What is the purpose of this rule number? Since it obviously has nothing to do with the actual order of the rules being interpreted.
I can for example move rule #2 IPV4-TRANSIT-OUT to be first like this,
0 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-as-path=^$ invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
1 chain=IPV4-TRANSIT-IN invert-match=no action=accept set-bgp-local-pref=100 set-bgp-prepend-path="" set-bgp-med=5000
2 chain=IPV4-TRANSIT-IN invert-match=no action=discard set-bgp-prepend-path=""
3 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-communities=41281:9000 invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
4 chain=IPV4-TRANSIT-OUT invert-match=no action=discard set-bgp-prepend-path=""
---
Which would make the whole thing very confusing when looking at.
So my questions are. Is there any difference in processeing when doing the above? When moving rules in a chain so it's not grouped together but keeping the same order?
If there is no difference then maybe Mikrotik should instead change/add so the assignment of a number to the rules are grouped per chain. Example ,
0 chain=IPV4-TRANSIT-IN invert-match=no action=accept set-bgp-local-pref=100 set-bgp-prepend-path="" set-bgp-med=5000
1 chain=IPV4-TRANSIT-IN invert-match=no action=discard set-bgp-prepend-path=""
0 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-as-path=^$ invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
1 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-communities=41281:9000 invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
2 chain=IPV4-TRANSIT-OUT invert-match=no action=discard set-bgp-prepend-path=""
--
Another example is if you print a single chain , routing filter print where chain=IPV4-TRANSIT-IN it will assign a number from 0 and up. Confirming that the rule number is just some incremental counter not really connected to the actual rule just to the output of the print.
What confuses everything more then is the following,
routing filter print where chain=IPV4-TRANSIT-OUT :
0 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-as-path=^$ invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
1 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-communities=41281:9000 invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
2 chain=IPV4-TRANSIT-OUT invert-match=no action=discard set-bgp-prepend-path=""
If I now want to move let's say rule #1 to be #0 I can't use the numbers provided in the output but I have to use the numbers provided when printing all the rules,
routing filter print :
0 chain=IPV4-TRANSIT-IN invert-match=no action=accept set-bgp-local-pref=100 set-bgp-prepend-path="" set-bgp-med=5000
1 chain=IPV4-TRANSIT-IN invert-match=no action=discard set-bgp-prepend-path=""
2 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-as-path=^$ invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
3 chain=IPV4-TRANSIT-OUT match-chain=IPV4-WORLD-OUT bgp-communities=41281:9000 invert-match=no action=accept set-bgp-prepend-path="" set-bgp-med=1000
4 chain=IPV4-TRANSIT-OUT invert-match=no action=discard set-bgp-prepend-path=""
routing filter move numbers=3 destination=2
--
I'm sorry for the confusing post. I hope someone understands And either can say that i'm doing it wrong or that maybe mikrotik can assign a number to rules within their chain. Just like in for example cisco "route-map IPV4-TRANSIT-OUT permit 10", "permit 20" etc.
--