Vyatta NOS documentation

Learn how to install, configure, and operate Vyatta Network Operating System (Vyatta NOS), which helps to drive our virtual networking and physical platforms portfolio.

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.

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.

Figure 1. Configuration of MED value that is based on IGP metric
Router Step Commands
R4 Display the state of BGP routing table before setting the MED value.
vyatta@R4# show ip bgp 172.11.0.0/24
BGP routing table entry for 172.11.0.0/24
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.34.0.3
  100
    10.24.0.2 from 10.24.0.2 (1.1.1.2)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Last update: Tue Feb 24 15:06:20 2015

  100
    10.34.0.3 from 10.34.0.3 (1.1.1.3)
      Origin IGP, metric 0, localpref 100, valid, external
      Last update: Tue Feb 24 15:05:50 2015
R2 Set the MED value that is based on IGP metric for R2.
vyatta@R2# set protocols bgp 100 neighbor 10.24.0.4 med-out igp
R3 Set the MED value that is based on IGP metric for R3.
vyatta@R3# set protocols bgp 100 neighbor 10.24.0.4 med-out igp
R1 Commit the configuration.
vyatta@R1# commit
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.
vyatta@R4# show ip bgp 172.11.0.0/24
BGP routing table entry for 172.11.0.0/24
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.24.0.2
  100
    10.34.0.3 from 10.34.0.3 (1.1.1.3)
      Origin IGP, metric 20, localpref 100, valid, external, best
      Last update: Tue Feb 24 16:34:17 2015
  100
    10.24.0.2 from 10.24.0.2 (1.1.1.2)
      Origin IGP, metric 30, localpref 100, valid, external
      Last update: Tue Feb 24 16:33:41 2015