For sites where we peer at multiple IXPs, for example ulsfo where we have Equinix and SFMIX, we want to be able to prioritize one over the other.
- Better latency (SFMIX is closer in term of ms)
- Better balancing (SFMIX is smaller and thus less used)
As a side note I documented all the BGP communities we have defined in https://wikitech.wikimedia.org/wiki/IP_and_AS_allocations#BGP_communities
I introduced a new BGP community PEERING_ROUTE_PRIMARY which set the local-pref of 10 above the regular PEERING_ROUTE.
As well as a new policy BGP_IXP_PRIMARY_in duplicating BGP_IXP_in to be applied to the matching groups (eg. IX4/6).
To be configured in Homer of course.
[edit policy-options] + policy-statement BGP_IXP_PRIMARY_in { + term filter { + from as-path-group AS-PATH-FILTER; + then reject; + } + term avoid-paths { + from as-path-group AVOID-PATHS; + then { + community add AVOIDED_PATH; + } + } + term rpki-classification { + from policy BGP_rpki; + } + term selected-paths { + from as-path-group SELECTED-PATHS; + then { + community add SELECTED_PATH; + } + } + term damping { + then damping default; + } + then { + community add PEERING_ROUTE_PRIMARY; + next policy; + } + } [edit policy-options policy-statement BGP_community_actions] term ixp-peer { ... } + term ixp-primary-peer { + from community PEERING_ROUTE_PRIMARY; + then { + local-preference 260; + next policy; + } + } [edit policy-options] + community PEERING_ROUTE_PRIMARY members 14907:2; [edit protocols bgp group IX4] - import [ BGP_sanitize_in BGP_IXP_in BGP_community_actions ]; + import [ BGP_sanitize_in BGP_IXP_PRIMARY_in BGP_community_actions ]; [edit protocols bgp group IX4 neighbor 206.197.187.253] - import [ BGP_sanitize_in BGP_IXP_RS_in BGP_IXP_in BGP_community_actions ]; + import [ BGP_sanitize_in BGP_IXP_RS_in BGP_IXP_PRIMARY_in BGP_community_actions ]; [edit protocols bgp group IX4 neighbor 206.197.187.254] - import [ BGP_sanitize_in BGP_IXP_RS_in BGP_IXP_in BGP_community_actions ]; + import [ BGP_sanitize_in BGP_IXP_RS_in BGP_IXP_PRIMARY_in BGP_community_actions ]; [edit protocols bgp group IX6] - import [ BGP_sanitize_in BGP_IXP_in BGP_community_actions ]; + import [ BGP_sanitize_in BGP_IXP_PRIMARY_in BGP_community_actions ]; [edit protocols bgp group IX6 neighbor 2001:504:30::ba06:3055:1] - import [ BGP_sanitize_in BGP_IXP_RS_in BGP_IXP_in BGP_community_actions ]; + import [ BGP_sanitize_in BGP_IXP_RS_in BGP_IXP_PRIMARY_in BGP_community_actions ]; [edit protocols bgp group IX6 neighbor 2001:504:30::ba06:3055:2] - import [ BGP_sanitize_in BGP_IXP_RS_in BGP_IXP_in BGP_community_actions ]; + import [ BGP_sanitize_in BGP_IXP_RS_in BGP_IXP_PRIMARY_in BGP_community_actions ];