Supported Platforms
Related Documentation
- ACX, J, M, MX, PTX, SRX, T Series, QFabric System, QFX Series standalone switches
- Understanding BGP Path Selection
- ACX, J, M, MX, SRX Series
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
Example: Associating the MED Path Attribute with the IGP Metric and Delaying MED Updates
This example shows how to associate the multiple exit discriminator (MED) path attribute with the interior gateway protocol (IGP) metric, and configure a timer to delay update of the MED attribute.
Requirements
No special configuration beyond device initialization is required before you configure this example.
Overview
BGP can be configured to advertise the MED attribute for a route based on the IGP distance of its internal BGP (IBGP) route next-hop. The IGP metric enables internal routing to follow the shortest path according to the administrative setup. In some deployments, it might be ideal to communicate IGP shortest-path knowledge to external BGP (EBGP) peers in a neighboring autonomous system (AS). This allows those EBGP peers to forward traffic into your AS using the shortest paths possible.
Routes learned from an EBGP peer usually have a next hop on a directly connected interface, and thus the IGP value is equal to zero. Zero is the value advertised. The IGP metric is a nonzero value when a BGP peer sends third-party next hops that require the local system to perform next-hop resolution—IBGP configurations, configurations within confederation peers, or EBGP configurations that include the multihop command. In these scenarios, it might make sense to associate the MED value with the IGP metric by including the metric-out minimum-igp or metric-out igp option.
The drawback of associating the MED with the IGP metric is the risk of excessive route advertisements when there are IGP instabilities in the network. Configuring a delay for the MED update provides a mechanism to reduce route advertisements in such scenarios. The delay works by slowing down MED updates when the IGP metric for the next hop changes. The approach uses a timer to periodically advertise MED updates. When the timer expires, the MED attribute for routes with metric-out igp delay-updates configured is updated to the current IGP metric of the next hop. The BGP-enabled device sends out advertisements for routes for which the MED attribute has changed.
The delay-updates option identifies the BGP groups (or peers) for which the MED updates must be suppressed. The time for advertising MED updates is set to 10 minutes by default. You can increase the interval up to 600 minutes by including the med-igp-update-interval statement in the routing-options configuration.
![]() | Note: If you have nonstop active routing (NSR) enabled and a switchover occurs, the delayed MED updates might be advertised as soon as the switchover occurs. |
When you configure the metric-out igp option, the IGP metric directly tracks the IGP cost to the IBGP peer. When the IGP cost goes down, so does the advertised MED value. Conversely, when the IGP cost goes up, the MED value goes up as well.
When you configure the metric-out minimum-igp option, the advertised MED value changes only when the IGP cost to the IBGP peer goes down. An increase in the IGP cost does not affect the MED value. The router monitors and remembers the lowest IGP cost until the routing process (rpd) is restarted. The BGP peer sends an update only if the MED is lower than the previously advertised value or another attribute associated with the route has changed, or if the BGP peer is responding to a refresh route request.
This example uses the metric statement in the OSPF configuration to demonstrate that when the IGP metric changes, the MED also changes after the configured delay interval. The OSPF metric can range from 1 through 65,535.
Figure 1 shows the sample topology.
Figure 1: Topology for Delaying the MED Update

In this example, the MED value advertised by Device R1 is associated with the IGP running in AS 1. The MED value advertised by Device R1 impacts the decisions of the neighboring AS (AS 2) when AS 2 is forwarding traffic into AS 1.
Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
Device R1
Device R2
Device R3
Device R4
Device R5
Device R6
Device R7
Device R8
Configuring Device R1
Step-by-Step Procedure
The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure Device R1:
- Configure the interfaces.[edit interfaces fe-1/2/0 unit 2]user@R1# set description R1->R2user@R1# set family inet address 10.0.0.1/30
[edit interfaces fe-1/2/1 unit 7]user@R1# set description R1->R4user@R1# set family inet address 172.16.0.1/30
[edit interfaces lo0 unit 1]user@R1# set family inet address 192.168.0.1/32 - Configure IBGP.[edit protocols bgp group internal]user@R1# set type internaluser@R1# set local-address 192.168.0.1user@R1# set export send-directuser@R1# set neighbor 192.168.0.2user@R1# set neighbor 192.168.0.3
- Configure EBGP.[edit protocols bgp group external]user@R1# set type externaluser@R1# set export send-directuser@R1# set peer-as 2user@R1# set neighbor 172.16.0.2
- Associate the MED value with the IGP metric.[edit protocols bgp group external]user@R1# set metric-out igp delay-med-update
The default for the MED update is 10 minutes when you include the delay-med-update option. When you exclude the delay-med-update option, the MED update occurs immediately after the IGP metric changes.
- (Optional) Configure the update interval for the MED update.[edit routing-options]user@R1# set med-igp-update-interval 12
You can configure the interval from 10 minutes through 600 minutes.
- Configure OSPF.[edit protocols ospf area 0.0.0.0]user@R1# set interface fe-1/2/0.2 metric 600user@R1# set interface lo0.1 passive
The metric statement is used here to demonstrate what happens when the IGP metric changes.
- Configure a policy that accepts direct routes.
Other useful options for this scenario might be to accept routes learned through OSPF or local routes.
[edit policy-options policy-statement send-direct term 1]user@R1# set from protocol directuser@R1# set then accept - Configure the router ID and autonomous system (AS) number.[edit routing-options]user@R1# set router-id 192.168.0.1user@R1# set autonomous-system 1
Results
From configuration mode, confirm your configuration by entering the show interfaces, show policy-options, show protocols, and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
If you are done configuring the device, enter commit from configuration mode. Repeat the configuration steps on the other devices in the topology, as needed for your network.
Verification
Confirm that the configuration is working properly.
- Checking the BGP Advertisements
- Verifying That the MED Value Changes When the OSPF Metric Changes
- Testing the minimum-igp Setting
Checking the BGP Advertisements
Purpose
Verify that Device R1 is advertising to Device R4 a BGP MED value that reflects the IGP metric.
Action
From operational mode, enter the show route advertising-protocol bgp command.
user@R1> show route advertising-protocol bgp
172.16.0.2
inet.0: 19 destinations, 33 routes (19 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.0/30 Self 0 I * 172.16.0.0/30 Self 0 I * 172.16.0.4/30 Self 601 I * 192.168.0.1/32 Self 0 I
Meaning
The 601 value in the MED column shows that the MED value has been updated to reflect the configured OSPF metric.
Verifying That the MED Value Changes When the OSPF Metric Changes
Purpose
Make sure that when you raise the OSPF metric to 700, the MED value is updated to reflect this change.
Action
From configuration mode, enter the set protocols ospf area 0 interface fe-1/2/0.2 metric 700 command.
user@R1# set protocols ospf area 0 interface
fe-1/2/0.2 metric 700
user@R1# commit
After waiting 12 minutes (the configured delay period), enter the show route advertising-protocol bgp command from operational mode.
user@R1> show route advertising-protocol bgp
172.16.0.2
inet.0: 19 destinations, 33 routes (19 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.0/30 Self 0 I * 172.16.0.0/30 Self 0 I * 172.16.0.4/30 Self 701 I * 192.168.0.1/32 Self 0 I
Meaning
The 701 value in the MED column shows that the MED value has been updated to reflect the configured OSPF metric.
Testing the minimum-igp Setting
Purpose
Change the configuration to use the minimum-igp statement instead of the igp statement. When you increase the OSPF metric, the MED value remains unchanged, but when you decrease the OSPF metric, the MED value reflects the new OSPF metric.
Action
From configuration mode, delete the igp statement, add the minimum-igp statement, and increase the OSPF metric.
user@R1# delete protocols bgp group external
metric-out igp
user@R1# set protocols bgp group external metric-out
minimum-igp
user@R1# set protocols ospf area 0 interface
fe-1/2/0.2 metric 800
user@R1# commit
From operational mode, enter the show route advertising-protocol bgp command to make sure that the MED value does not change.
user@R1> show route advertising-protocol bgp
172.16.0.2
inet.0: 19 destinations, 33 routes (19 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.0/30 Self 0 I * 172.16.0.0/30 Self 0 I * 172.16.0.4/30 Self 701 I * 192.168.0.1/32 Self 0 I
From configuration mode, decrease the OSPF metric.
user@R1# set protocols ospf area 0 interface
fe-1/2/0.2 metric 20
user@R1# commit
From operational mode, enter the show route advertising-protocol bgp command to make sure that the MED value does change.
user@R1> show route advertising-protocol bgp
172.16.0.2
inet.0: 19 destinations, 33 routes (19 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.0/30 Self 0 I * 172.16.0.0/30 Self 0 I * 172.16.0.4/30 Self 21 I * 192.168.0.1/32 Self 0 I
Meaning
When the minimum-igp statement is configured, the MED value changes only when a shorter path is available.
Related Documentation
- ACX, J, M, MX, PTX, SRX, T Series, QFabric System, QFX Series standalone switches
- Understanding BGP Path Selection
- ACX, J, M, MX, SRX Series
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
Published: 2014-07-23
Supported Platforms
Related Documentation
- ACX, J, M, MX, PTX, SRX, T Series, QFabric System, QFX Series standalone switches
- Understanding BGP Path Selection
- ACX, J, M, MX, SRX Series
- Understanding External BGP Peering Sessions
- BGP Configuration Overview