Latest

BGP : bgp deterministic-med and bgp always-compare-med

Today I am going to discuss about some of the BGP commands, starting from one of the common parameters used by service providers to route the traffic over the specific path

The MED is one of the parameters that is considered when selecting the best path among many alternative paths. The path with a lower MED is preferred over a path with a higher MED.

By default, during the best-path selection process, MED comparison is done only among paths from the same autonomous system. This command changes the default behavior by allowing comparison of MEDs among paths regardless of the autonomous system from which the paths are received.

Fig 1.1- BGP MED Parameter


“bgp always-compare-med”
You heard about this command but some of you know about the functionality of this command. Let’s talk about “bgp always-compare-med”

When you want to allow the comparison of the Multi Exit Discriminator (MED) for paths from neighbors in different autonomous systems, use the bgp always-compare-med router configuration command.

The important thing to note here is “different autonomous systems”

Configuring “bgp always-compare-med”
R1(config)#router bgp 500
R1(config-router)#bgp always-compare-med

“bgp deterministic-med”
The other command you heard about is “bgp deterministic-med” , When using the “bgp deterministic-med”  comparison is made across all routes received from the same autonomous system.

The important thing to note here is “same autonomous system”

Configuring “bgp deterministic-med
R1(config)#router bgp 600
R1(config-router)# bgp deterministic-med

So, let’s understand if “bgp deterministic-med” Enabled

Group1Entry1: ASPATH 1, MED 500, internal, IGP metric to NEXT_HOP 10 >>>> AS500
Group1Entry 2: ASPATH 2, MED 550, internal, IGP metric to NEXT_HOP 5>>>>AS500
Group2Entry3: ASPATH 1, MED 600, external >>>AS600

So, in group 1, there are two entries and the best path is entry 1, Why ? because of lower MED value.
In group 2, we have only one entry, so it is best path in another group

So now the question, are these two entries which is best from each group compared ? The answer is no because “bgp deterministic-med” only compare with in same AS number. So how can these be compared then ? As we discuss above to compare with two different AS you need “bgp always-compare-med”

Ok, let’s understand one more thing, if we disable bgp deterministic-med, the order in which routes are received may impact MED-based best path decisions. This can occur when the same route is received from multiple ASs or confederation sub-ASs, with the same path length, but different MEDs.

“bgp bestpath med missing-med-worst
If the MED is not attached to a BGP route, it is interpreted as value 0, and thus as the best metric. With this command, a missing MED is interpreted as infinity (worst).

R1(config-router)# bgp bestpath med missing-med-worst

“bgp bestpath med-confed”
To enable MED comparison among paths learned from confederation peers, use the bgp bestpath med-confed router configuration command. To prevent the software from considering the MED attribute in comparing paths, use the no form of this command

R1(config-router)# bgp bestpath med-confed

Recommendation
Well, if you say you have more than 3 entries and having two or three different AS numbers, we would recommend to enable both “bgp deterministic-med” and “bgp always-compare-med”