The deterministic-med command enables the BGP deterministic-MED function so that routes with the same leftmost AS number are first compared during route selection.
The undo deterministic-med command disables the BGP deterministic-MED function so that routes are compared against each other according to the sequence in which they are received.
By default, the BGP deterministic-MED function is disabled.
BGP view, BGP-IPv4 unicast address family view, BGP-IPv4 multicast address family view, BGP-VPN instance IPv4 address family view, BGP-IPv6 unicast address family view, BGP-VPN instance IPv6 address family view
After the BGP deterministic-MED function is enabled, when an optimal route is to be selected from routes that are received from different ASs and carry the same prefix, routes are first grouped based on the leftmost AS number in the AS_Path attribute. Routes with the same leftmost AS number are grouped together, and after comparison, an optimal route is selected for the group. The group optimal route is then compared with optimal routes from other groups to determine the final optimal route. This mode of route selection ensures that the sequence in which routes are received is irrelevant to the route selection result.
If the BGP deterministic-MED function is disabled, routes are compared against each other according to the sequence in which they are received. In this manner, the sequence in which routes are received is relevant to the result of route selection.
Route A1: AS(PATH) 12, med 100, igp metric 13, internal, rid 4.4.4.4
Route A2: AS(PATH) 12, med 150, igp metric 11, internal, rid 5.5.5.5
Route B: AS(PATH) 3, med 0, igp metric 12, internal, rid 6.6.6.6
If Route A1, Route A2, and Route B are received in turn, Route A1 and Route A2 are first compared. The leftmost AS number of Route A1 is the same as the leftmost AS number of Route A2, and therefore Route A1 is selected because its MED is smaller. After that, Route A1 and Route B are compared. Because the leftmost AS numbers of the two routes are different, the optimal route cannot be selected by comparing the MEDs of the two routes unless the compare-different-as-med command is configured. As a result, Route B is selected because its IGP metric is smaller.
If Route A2, Route B, and Route A1 are received in turn, Route A2 and Route B are first compared. Because leftmost AS number of Route A2 is different from the leftmost AS number of Route B, the optimal route cannot be selected by comparing the MEDs of the two routes unless the compare-different-as-med command is configured. As a result, Route A2 is selected because its IGP metric is smaller. After that, Route A2 and Route A1 are compared. The leftmost AS number of Route A1 is the same as the leftmost AS number of Route A2, and therefore Route A1 is selected because its MED is smaller.
Judging from the preceding route selection procedure, when the BGP deterministic-MED function is disabled, the sequence in which routes are received is relevant to the result of route selection. After the BGP deterministic-MED function is enabled, the sequence in which routes are received is no longer relevant to the result of route selection. Route A1 and Route A2 have the same leftmost AS number, Route A1 and Route A2 are compared first regardless of the sequence in which routes are received.