BGP deterministic-med & compare-med

Cisco recommends enabling the bgp deterministic-med command in all new network deployments. For existing networks, this command must be deployed on all routers at the same time, or this command must be deployed gradually, but care should be taken to avoid possible internal BGP (IBGP) Routing loop.

For example, consider the following route for network 10.0.0 / 8:
entry1: AS 500, med 150, external, rid 172.16.13.1
entry2: as 100, med 200, external, rid 1.1.1.1
entry3: as 500, med 100, internal, rid 172.16.8.4

The order in which BGP routes are received is entry3, entry2, and entry1. (Entry3 is the oldest entry in the BGP table, entry1 is the latest entry)
Note: When BGP receives multiple routes to a specific destination, it will receive List them in reverse order to route (from newest to oldest), then BGP compares the routes in pairs in the following order; start with the latest entry and move to the oldest entry (from the top of the list, move down) For example, compare entry1 with entry2. Then, compare the better of these two with entry3, and so on.


Example 1, both commands disable bgp deterministic-med bgp always-compare-med
first compares entry1 with entry2. Because entry2 has a smaller router ID, it is selected as the better of the two. Because of the path It is from a different neighbor autonomous system, so MED is not checked. Next, compare entry2 with entry3. Because entry2 is an external path, it is selected as the best path.

Example 2, bgp deterministic-med is disabled, bgp always-compare-med is enabled

Compare entry1 with entry2. These entries come from different neighbor autonomous systems, but because the bgp always-compare-med command is enabled, MED is used in the comparison. Of these two entries, entry1 has a smaller MED, so It is better. Next, compare entry1 with entry3. Since the entries are now from the same autonomous system, the MED will be checked twice and entry3 is selected as the best path.

Example 3, bgp deterministic-med is enabled, bgp always-compare-med is disabled
When the bgp deterministic-med command is enabled, routes from the same autonomous system will be grouped together, and then the best entries of each group are compared.BGP table As follows.

entry1 as 100 med 200 external rid 1.1.1.1
entry2 as 500 med 100 internal rid 172.16.8.4
entry3 as 500 med 150 external rid 172.16.13.1

There is an AS100 group and an AS500 group, comparing the best entries of each group. Entry1 is the best entry in its group because it is the only route from AS100. Entry2 is the best entry for AS500 because of its MED is the smallest. Next, compare entry1 with entry2. Because these two entries are not from the same neighbor autonomous system, MED is not considered in the comparison. External BGP routes are better than internal BGP routes, which makes entry1 the best route .

Example 4, both commands are enabled
. The comparison in this example is basically the same as in Example 3, but the last comparison was made between entry2 and entry1. Since the bgp always-compare-med command is enabled, the last comparison is considered After MED, entry2 was selected as the best path.

Published 220 original articles · won praise 2 · Views 4463

Guess you like

Origin blog.csdn.net/qq_43207781/article/details/105503604
BGP