BGP Best Path Selection with MED
Posted: Fri Apr 30, 2021 8:25 pm
Hello!
I've a problem with the BGP best path selection algorithm. I'm not getting, why in my case the first route is selected as "best". We are using bgp-local-pref=200 for IXP-Peering-Routes. For prefering a special IXP we tag those routes with different MEDs so that we still prefer shortest AS-path. We would like to prefer a Hamburg IXP over Amsterdam, Munich or Dusseldorf. So here are some routes to Google. But although the route from Munich has a higher MED as all other routes it is installed as "best". Why?
If I shutdown the BGP-session to the Munich route server one of the Hamburg routes is the best one as expected.
This is real world data but no information you wouldn't be able to get from peeringdb.
I've a problem with the BGP best path selection algorithm. I'm not getting, why in my case the first route is selected as "best". We are using bgp-local-pref=200 for IXP-Peering-Routes. For prefering a special IXP we tag those routes with different MEDs so that we still prefer shortest AS-path. We would like to prefer a Hamburg IXP over Amsterdam, Munich or Dusseldorf. So here are some routes to Google. But although the route from Munich has a higher MED as all other routes it is installed as "best". Why?
Code: Select all
[admin@XXX] > /ip route print detail where dst-address=23.227.34.0/24
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=23.227.34.0/24 gateway=80.81.202.170 gateway-status=80.81.202.170 reachable via vlan-de-cix-muc distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=230 bgp-origin=egp
bgp-communities=64800:40001,64800:41004,64800:42004,64800:49999,65101:3096,65102:3000,65103:276,65104:150 received-from=de-cix.muc.rs1
1 Db dst-address=23.227.34.0/24 gateway=80.81.203.34 gateway-status=80.81.203.34 reachable via vlan-de-cix-ham distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=100 bgp-origin=egp
bgp-communities=64800:40001,64800:41001,64800:42002,64800:49999,65101:4081,65102:4000,65103:276,65104:150 received-from=de-cix.ham.rs1
2 Db dst-address=23.227.34.0/24 gateway=80.81.203.34 gateway-status=80.81.203.34 reachable via vlan-de-cix-ham distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=100 bgp-origin=egp
bgp-communities=64800:40001,64800:41001,64800:42002,64800:49999,65101:4081,65102:4000,65103:276,65104:150 received-from=de-cix.ham.rs2
3 Db dst-address=23.227.34.0/24 gateway=80.249.208.247 gateway-status=80.249.208.247 reachable via vlan-ams-ix distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=220 bgp-origin=egp bgp-communities=64800:40002,64800:41005,64800:42005,64800:49999
received-from=ams-ix.rs1
4 Db dst-address=23.227.34.0/24 gateway=80.249.208.247 gateway-status=80.249.208.247 reachable via vlan-ams-ix distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=220 bgp-origin=egp bgp-communities=64800:40002,64800:41005,64800:42005,64800:49999
received-from=ams-ix.rs2
5 Db dst-address=23.227.34.0/24 gateway=80.81.203.34 gateway-status=80.81.203.34 reachable via vlan-de-cix-ham distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=100 bgp-origin=egp bgp-communities=64800:40001,64800:41001,64800:42002,64800:49999
received-from=de-cix.ham.google
6 Db dst-address=23.227.34.0/24 gateway=62.115.144.140 gateway-status=62.115.144.140 reachable via vlan-telia-iptransit distance=20 scope=40
target-scope=10 bgp-as-path="1299,15169,396982" bgp-local-pref=100 bgp-origin=egp bgp-communities=1299:20000 received-from=telia
Code: Select all
[admin@XXX] /ipv6 firewall address-list> /ip route print detail where dst-address=23.227.34.0/24
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=23.227.34.0/24 gateway=80.81.203.34 gateway-status=80.81.203.34 reachable via vlan-de-cix-ham distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=100 bgp-origin=egp
bgp-communities=64800:40001,64800:41001,64800:42002,64800:49999,65101:4081,65102:4000,65103:276,65104:150 received-from=de-cix.ham.rs1
1 Db dst-address=23.227.34.0/24 gateway=80.81.203.34 gateway-status=80.81.203.34 reachable via vlan-de-cix-ham distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=100 bgp-origin=egp
bgp-communities=64800:40001,64800:41001,64800:42002,64800:49999,65101:4081,65102:4000,65103:276,65104:150 received-from=de-cix.ham.rs2
2 Db dst-address=23.227.34.0/24 gateway=80.249.208.247 gateway-status=80.249.208.247 reachable via vlan-ams-ix distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=220 bgp-origin=egp bgp-communities=64800:40002,64800:41005,64800:42005,64800:49999
received-from=ams-ix.rs1
3 Db dst-address=23.227.34.0/24 gateway=80.249.208.247 gateway-status=80.249.208.247 reachable via vlan-ams-ix distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=220 bgp-origin=egp bgp-communities=64800:40002,64800:41005,64800:42005,64800:49999
received-from=ams-ix.rs2
4 Db dst-address=23.227.34.0/24 gateway=80.81.203.34 gateway-status=80.81.203.34 reachable via vlan-de-cix-ham distance=20 scope=40 target-scope=10
bgp-as-path="15169,396982" bgp-local-pref=200 bgp-med=100 bgp-origin=egp bgp-communities=64800:40001,64800:41001,64800:42002,64800:49999
received-from=de-cix.ham.google
5 Db dst-address=23.227.34.0/24 gateway=62.115.144.140 gateway-status=62.115.144.140 reachable via vlan-telia-iptransit distance=20 scope=40
target-scope=10 bgp-as-path="1299,15169,396982" bgp-local-pref=100 bgp-origin=egp bgp-communities=1299:20000 received-from=telia