Setting BGP MED based on the IGP metric
A multi-exit discriminator (MED) is a path attribute that the device considers during BGP best-path selection. The value of a MED informs the external neighbors about the preferred path into an autonomous system (AS) that has multiple entry points. During BGP best-path selection, the device prefers a lower MED value as compared with a higher value
You can send a MED value which is based on the IGP metric. When you configure a MED value, based on the IGP metric for a neighbor, the MED value is copied from the IGP metric and sent to the neighbor. Copying the MED value from the IGP metric allows eBGP peers from neighboring AS to send traffic to local AS by using the shortest path. The shortest path is based on the IGP administrative domain.
However, if a route-map for a particular neighbor is already configured with set-metric, then the set-metric command takes priority and the med-out configuration is ignored. For more information about setting a MED value based on the IGP metric, see the following commands.
- protocols bgp <asn> neighbor <id> med-out igp
- protocols bgp <asn> neighbor <id> med-out igp delay- updates
- protocols bgp <asn> neighbor <id> med-out minimum-igp
- protocols bgp <asn> peer-group <name> med-out igp
- protocols bgp <asn> peer-group <name> med-out igp delay-updates
- protocols bgp <asn> peer-group <name> med-out minimum-igp .
The following example illustrates the configuration of a MED value that is based on IGP cost. In the example, R1, R2, R3 are IBGP peers. R1 is connected to R2 and R3 by using OSPF protocol. They are connected in the same AS. R4 is a neighbor of AS. R4 is an eBGP neighbor for R2 and R3. The IGP metric for R2 and R1 is 30 and the IGP metric for R1 and R3 is 20.
Router | Step | Commands |
---|---|---|
R4 | Display the state of BGP routing table before setting the MED value. |
|
R2 | Set the MED value that is based on IGP metric for R2. |
|
R3 | Set the MED value that is based on IGP metric for R3. |
|
R1 | Commit the configuration. |
|
R4 | Display the state of BGP routing table after setting the MED value. Note: In the output, best determines the best path recommended by the device during BGP best-path selection. |
|