jayray
November 15, 2021, 7:00am
1
How to add/cost outbound bgp advertisements on v7.rc6? I see in route filters "set bgp-weight " but it doesn’t accept any string to the parameter such as “20” or “+20”. That is all I could find that would possibly do outbound costing. Thanks for the help.
__
mrz
November 15, 2021, 8:18am
2
It doesn’t make sense to set bgp-weight in the output, it is local to the router and is never sent out.
jayray
November 15, 2021, 3:27pm
3
I get that, but some things are labeled differently in routeros.. I’m looking for the equivalent of “set metric +XX” to be applied outbound
If MED is what you’re trying to set, this should be the syntax:
routing/filter/rule/add chain=test rule="if (dst==200:7ac0:cafe::/48) {set bgp-med 30;accept}"
As MRZ noted, this metric is used by the peer ASN to determine the best inbound path.
If you’re trying to adjust traffic leaving your ASN, then you want to look at attributes like localpref on received routes.
jayray
November 15, 2021, 4:22pm
5
Does bgp-med increase outbound metric?
What does the term outbound mean to you? outbound traffic or outbound advertised routes?
What result are you trying to achieve?
jayray
November 15, 2021, 4:38pm
7
Outbound route advertisement. On every implementation of bgp I am using, an outbound filter can attach a cost to the outbound BGP route that is received and applied to the inbound route on the destination peer. This is implemented in zebra/quagga/frr/cisco/junos. I’m sure I’m just not finding the correct config terms… Below is a sample from quagga
route-map MESH2-OUT permit 10
match ip address 19
set metric +80
Then we are talking about the same BGP attribute which is BGP MED. The config I posted above when applied to an outbound peering should work.
From the Quagga Docs…
jayray
November 15, 2021, 10:09pm
9
Using both bgp-out-med and bgp-med doesn’t change the metric received on the other device. I’ve tried using the following filters.
rule=“if (dst in 0.0.0.0/0 && dst-len == 0) {set bgp-out-med +60; accept}”
rule=“if (dst in 0.0.0.0/0 && dst-len == 0) {set bgp-med +60; accept}”
Network Next Hop Metric LocPrf Weight Path
0.0.0.0 10.0.0.2 0 XXX02 i
Where other devices are sending a metric:
Network Next Hop Metric LocPrf Weight Path
0.0.0.0 10.0.0.2 0 XXX02 i
10.0.0.7 40 0 XXX01 i
i 10.0.0.107 10 300 0 XXX00 i
*> 10.0.0.5 20 400 0 XXX00 i
jayray
November 16, 2021, 7:49pm
10
setting any of the following does not work. I think this is a v7 bug, as it works in v6 with no issues.
add chain=bgp-out-to-core disabled=no rule=“if (dst in 0.0.0.0/0 && dst-len == 0) {set bgp-out-med +60; accept}”
add chain=bgp-out-to-core disabled=no rule=“if (dst in 0.0.0.0/0 && dst-len == 0) {set bgp-med +60; accept}”
add chain=bgp-out-to-core disabled=no rule=“set bgp-med +60; accept”
add chain=bgp-out-to-core disabled=no rule=“set bgp-out-med +60; accept”
jayray
November 16, 2021, 9:17pm
11
The below works. The filters work on match once principal, so it was matching on bgp-med and then not following the next test filter.
add chain=bgp-out-to-core disabled=no rule=“if (dst in 0.0.0.0/0 && dst-len == 0) {set bgp-out-med 60; accept}”
add chain=bgp-out-to-core disabled=no rule=“set bgp-out-med 60; accept”
mrz
November 17, 2021, 8:47am
12
There is a difference between “set bgp-out-med 60” and “set bgp-out-med +60”.
The first one sets the MED value to 60,
the second one tries to get the current med value and add 60 to it, but if the value does not exist, then it will not do anything.
maxfava
November 26, 2023, 6:53pm
13
I noted that bgp-med does not work in iBGP
any idea?
Joni:
There is a difference between “set bgp-out-med 60” and “set bgp-out-med +60”.
The first one sets the MED value to 60,
the second one tries to get the current med value and add 60 to it, but if the value does not exist, then it will not do anything.
set bgp-med (for iBGP out-filter) still doesn’t work in v7.16. When it will be?
Because you should use bgp-out-med for output chain
set bgp-out-med for eBGP.
set bgp-med for iBGP.
That's according to mikrotik user guide.
Btw I tried both for iBGP and doesn't work at all