Whilst configuring an MPLS lab I came across the force option on the MPLS LDP router-id command and was not sure what it did?
After reading the documentation I will now explain the MPLS LDP router-id process and the relevance of the Force option.
How the LDP Router-ID is derived
If the MPLS Router-ID command has not been applied.
- The router checks the IP addresses of all operational interfaces.
- If any of these interfaces are loopbacks the router selects the highest loopback address for the LDP router-id
- If no loopback interfaces are configured the highest operational IP address is selected as the LDP router-id
This default method of assigning the LDP router-id can cause problems if the assigned id is not able to be advertised by the routing protocol.
The mpls router-id command allows you to specify an interface as the LDP router-id. You need to make sure the specified interface is up so it’s IP address can be used.
If you issue the command without the force option the router will select the ip address of the specified interface when it next selects an LDP router ID.
When you issue the mpls ldp router-id with the force option if the interface is up and it is not currently using the IP address as the router-id the router-id changes. This will tear down any existing LDP sessions and will interupt the MPLS forwarding.
If the interface is down, when it comes up the router-id will change.
Lets prove this on the CLI
First lets see what the current LDP router-id is
As you can see from this output the current router-id is 126.96.36.199:0
A quick look at the sh ip int brief we can see that this is lo0
From this output it is obvious that there is only one Loopback interface and this has been selected for the LDP router-id
So lets add another Loopack and try to make that the new router-id
At this point in time nothing happens
So lets try and change it with the mpls ldp router-id lo2 command
Again nothing happens, so lets try the force option
Using the force option the router-id is instantly changed and the LDP sessions are torn down
The new router-id is now 188.8.131.52 as shown below
Now there is an issue that you have broken the LDP neighbors because of a point I made earlier. 184.108.40.206 is not in OSPF so LDP is broken. To fix this I just put Loopback2 into OSPF area 0 and the neighbors come up
More information can be found in the Cisco Documentation here:
Why does the LDP router-id have to be a /32
This is best practice and not an absolute requirement. To make sure we don’t use a less specific router from ingress
to egress PE
If you have a /24 configured on the the loopback interface, by default
OSPF advertises the prefix for the loopback as a /32 (host route) regardless
of the subnet mask configured, LDP on the other hand will advertise it
according to the configured subnet mask.
If you configure ip ospf network point-to-point ospf will advertise the prefix
according to the configured network mask. If you do this then the FEC advertised
by LDP and the ospf advertised prefix will match. Data plane and control plan with work
and traffic will flow.
I would always recommend you configure your PE loopback interfaces using a /32
The reason traffic does not flow when there is a mis-match is because
the label switched path is not setup properly because the LDP FEC (/24) and the
ospf prefix (/32) don’t match.