BGP Best Path Selection & Manipulation

I’ll start with manipulation. These are the most common ways based on the direction of traffic flow.

Influence Inbound Traffic Flow based on updates sent to peers:
-AS-Path Prepending
-MED
-Communities

Influence Outbound Traffic Flow based on LOCAL config:
-Weight (Significant ONLY to the LOCAL ROUTER)
-Local Preference (Significant within the AS)

#EXAMPLES

INBOUND:
-ISP 1 can advertise a subset of the network, while ISP 2 can advertise another. For example, if you have a /22 network, you can advertise subnet /23 on your side, /23 on the other side, and /22 on both sides.

-You can add one or more AS numbers to the left of the AS Path to make it longer using AS-Path prepending.

-The BGP multi-exit discriminator (MED) characteristic can be used. When several entrance points are present, MED instructs the other AS on how to route traffic into the AS.

-You can use BGP communities with local preferences to put up flags to mark a collection of routes. The service provider can then utilize those flags to apply network-wide local preference.

-To allow eBGP routers to accept routes from the same AS, use the BGP allow-as and as-override subcommands.

OUTBOUND:
-Outbound traffic load balancing may be accomplished with default routes.

-You can obtain entire Internet tables and do AS-Path filtering or utilize provider-advertised partial routes from each provider.

-The local preference property can be used to specify the path to take to exit the autonomous system. It is decided to utilize the greater local preference.

#BGP BEST PATH SELECTION ORDER

This is the order used to select the paths.

1. WEIGHT – path with HIGHEST weight (Cisco Proprietary)
2. LOCAL_PREF – path with the HIGHEST LOCAL_PREF # (Default = 100)
3. Locally originated via NETWORK or AGGREGATE subcommands or through REDISTRIBUTION from IGP
4. AS_PATH – path with SHORTEST AS_PATH
5. Path with the LOWEST origin type
NOTE: IGP is lower than EGP and EGP is lower than INCOMPLETE
6. MED – path the the LOWEST MED
7. Prefer eBGP over iBGP paths
8. Path with the LOWEST IGP metric to the BGP next hop

That is not all of them but you’ll never get that far hopefully.

One more important note. ALWAYS filter both inbound and outbound announcements! Never assume that your peer will be doing your filtering for you.