I am a little bit confused with Mikrotik’s BGP MED attribute implementation.
Two observations from the LAB (tested both v5.24 and v6.0rc11):
MED works ok for EBGP sessions. But when propagating external routes to internal BGP (IBGP) neighbors, MED attributes are deleted.
When a Mikrotik router receives the same route from an EBGP neighbor and from an IBGP neighbor ( Cisco, by example, propagates MED attr. over IBGP sessions), MED values are not evaluated as part of the BGP best route selection process.
Are these observations correct ?
Is this the way MED is implemented in RouterOS’s BGP ?
The router compare MED attribute only for paths that have the same neighboring (leftmost) AS. Paths without explicit MED value are treated as with MED of 0
Thank you for your quick response but let me explain my question with more detail.
Imagine this scenario with 2 routers (R1 & R2) in AS65001 and another 2 (R3 & R4) in AS65002:
And if R3 is a router that propagates MED to IBGP peers (as Cisco or Juniper do) at R4 we have 2 routes to 10.10.12.0/24
both with the same:
Weight
Local Pref
AS Path
Origin
[admin@R4] > /ip route print detail
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
0 ADb dst-address=10.10.12.0/24 gateway=10.10.24.2
gateway-status=10.10.24.2 reachable via ether2 distance=20 scope=40
target-scope=10 bgp-as-path="65001" bgp-med=102 bgp-origin=incomplete
received-from=R2
1 Db dst-address=10.10.12.0/24 gateway=10.10.34.3
gateway-status=10.10.34.3 reachable via ether3 distance=200 scope=40
target-scope=30 bgp-as-path="65001" bgp-local-pref=100 bgp-med=101
bgp-origin=incomplete received-from=R3
From 1) and 2) it looks like MED in Mikrotik is used only in EBGP: It is not propagated to IBGP peers and it’s value is ignored when a route from an IBGP peer is one of the candidates.
I’d like to know if this is a design decision in RouterOS or a bug.