Set MED to IGP cost using route policies

This feature sets MED to the IGP cost of a route exported into BGP as an action in route policies. The med-out command in the bgp, group, and neighbor configuration context supports this option, but this method lacks per-prefix granularity. The enhanced metric command supported as a route policy action supports setting MED to a fixed number, or adding, or subtracting a fixed number from the received MED, and sets IGP cost option. The enhanced metric {set {igp | number1} | {add | subtract} number2} command is under config>router>policy-options>policy-statement>entry>action.

The metric set igp command, when used in a BGP export policy, have the same effect as the current med-out igp command, except that it applies only to the routes matched by the policy entry.

The effect of the metric set igp command depends on the route type and policy type as summarized in Table: Metric set IGP effect.

Table: Metric set IGP effect
BGP policy type Matched route type Set metric IGP effect

Export

Non-BGP route (static, OSPF, ISIS, and so on)

Add MED attribute. Set value to M.

Export

BGP route w/o MED

Add MED attribute. Set value to D.

Export

BGP route with MED (value A)

Overwrite MED attribute with value D.