LDP/IGP Sync (OSPF)
Load ospfv2.cfg
#IOS-XE
config replace flash:ospfv2.cfg
#IOS-XR
configure
load bootflash:ospfv2.cfg
commit replace
y
Configure LDP authentication for R2 on R3, using pass LDP23. Do not configure R2.
Configure LDP for all routers using autoconfig under OSPF.
Configure LDP sync so that all traffic from R1 to XR2 is always sent over R2-R4 instead of R2-R3 when LDP is not up between R2-R3.
Configure the R2-R3 link so that the IGP waits for LDP to be up for 20 seconds before reducing the metric.
Answer
#R1-R6
router ospf 1
mpls ldp autoconfig
mpls ldp sync
#R2
int Gi2.23
mpls ldp igp sync delay 20
#R3
mpls ldp nei 2.2.2.2 password LDP23
!
int Gi2.23
mpls ldp igp sync delay 20
#XR1-2
router ospf 1
mpls ldp auto-config
mpls ldp sync
!
mpls ldp
Explanation
Although the feature may sound complex, LDP/IGP sync is fairly simple. The problem it solves is if the IGP converges before LDP converges (perhaps before LDP has finished exchanging labels), routing may find a best path that is temporarily unlabeled, breaking any LSPs and VPNs running over those LSPs. To solve this issue, the IGP advertises the link metric as the max value, and when LDP is fully converged, the metric is reduced to the regular metric of the link. This discourages the use of the link by the IGP until LDP is fully converged, hence the IGP is “in sync” with LDP.
LDP/IGP sync comes with two parameters that are important:
Sync delay timer
Configurable on both IOS-XE and IOS-XR
Controls how long the IGP waits to reduce the metric value once LDP is converged
Default value is 0 seconds
Holddown timer
Configurable only on IOS-XE
Controls how long IGP will wait to hear LDP hellos before finally giving up and establishing an IGP adjacency, and then setting metric to max value
Default value is infinite on IOS-XE
Does not appear to be implemented on IOS-XR
You could consider the default value 0 on IOS-XR
Naturally, LDP/IGP sync is configured under the IGP process as follows:
#IOS-XE
router ospf 1
mpls ldp sync
!
router isis 1
mpls ldp sync
#IOS-XR
router ospf 1
mpls ldp sync
!
router isis 1
int gi0/0/0/0
add ipv4
mpls ldp sync
We can only configure the sync delay under each interface individually.
#IOS-XE
int Gi2.23
mpls ldp igp sync delay 20
#IOS-XR
mpls ldp
interface GigabitEthernet0/0/0/0
igp sync delay on-session-up 20
We set the holddown timer in IOS-XE globally:
#IOS-XE
mpls ldp igp sync holddown <msec>
Verification
First examine R2’s routing table and notice that no paths are via R3. R2 does not have an LDP session established with R3 due to the mismatched auth. This is a sign that the LDP/IGP sync feature is working.

If we look at the OSPF interface cost, we see that the Gi2.23 cost is still 1, which is a little confusing. You might expect this to be 65535.

However, if you inspect the router’s Router LSA, you can see that the metric is indeed set to the maximum. The interface’s “regular” or “configured” cost is 1, which is what is reflected in the previous output.

A handy command for verifying LDP/IGP sync is show mpls ldp igp sync. We can see on R2 that Gi1.23 is currently in a status of “sync not achieved; peer reachable.”

If we remove the authentication on R3, we should see that LDP is established. OSPF should then wait 20 seconds before changing the metric value back to 1. We can see this timer using the same show command as seen above.
#R3
no mpls ldp neighbor 2.2.2.2 password LDP23

Sync holddown
Let’s breifly explore the sync holddown feature. This is only configurable on IOS-XE. This feature is kind of complicated, because it seems to only be in use when the interface detects no LDP Hellos at all on the other side. So to simulate this, we will need to completely remove LDP on R3 Gi2.23.
#R3
int gi2.23
no mpls ldp igp autoconfig
However, the other problem is that R2 has already formed an OSPF adjacency with R3. So we need to clear OSPF on R2 now.
#R2
clear ip ospf proc
Now we can see that R2 has no OSPF adjacency at all with R3:

If we look at the OSPF status for this interface, we see that the state is DOWN (waiting for LDP). The interface is waiting to hear LDP Hellos. Without received LDP Hellos, the OSPF neighborship will never form.

If we change the holddown timer to something low, such as 10 seconds, we should see that eventually OSPF gives up and forms the adjacency anyways, albeit with max metric on the link. This seems better to me than waiting indefinitely, as that could cause a serious outage in production.
#R2
mpls ldp igp sync holddown 10000

Note that IOS-XR does not appear to implement this holddown timer. First, we can see that this parameter is not visible in the show output:

Second, if we make the same change, we can see that OSPF still forms:
#XR2
router ospf 1
no mpls ldp auto-config
#XR1
clear ospf proc
The sync status is “not ready”, meaning unsynchronized, but the OSPF neighborship still forms, unlike IOS-XE:

To me this seems better, because you can never cause an outage due to disabling LDP on IOS-XR when implementing IGP/LDP sync.
Last updated