# LDP and ECMP

Load **isis.cfg**

```
#IOS-XE
config replace flash:isis.cfg

#IOS-XR
configure
load bootflash:isis.cfg
commit replace
y
```

ISIS is already pre-configured. Configure LDP on all routers using LDP IGP autoconfig.

Notice that R2 has ECMP routes in its RIB. How will R2 treat traffic sourced from 1.1.1.1 destined for 19.19.19.19 by default?

## Answer <a href="#id-19bc9259-1d81-4a2a-9705-608912514783" id="id-19bc9259-1d81-4a2a-9705-608912514783"></a>

```
#R1-R6
router isis
 mpls ldp autoconfig

#XR1
router isis 1
 add ipv4
  mpls ldp auto-config
!
mpls ldp
```

## Explanation <a href="#id-7091f787-8a6b-4ae8-9458-c1a324f76062" id="id-7091f787-8a6b-4ae8-9458-c1a324f76062"></a>

LDP follows the IGP. So if there are ECMP paths in the IGP, both label bindings are installed in the LFIB.

We can check this by inspecting the LFIB entry for 19.19.19.19/32 on R2:

<div align="left"><figure><img src="/files/JMgisImjUQ4Kes6IS4AG" alt=""><figcaption></figcaption></figure></div>

It just so happens that both R3 and R4 allocated the label 23 for 19.19.19.19/32.

We can verify which path will be used for traffic sourced from R1 using the following command:

<div align="left"><figure><img src="/files/DYkBYVv4So8PwxqELmpE" alt=""><figcaption></figcaption></figure></div>

By default, the CEF load-sharing algorithm is **universal**, which only uses L3 information, but uses a hash so that each router makes a different hashing calculation. So when we traceroute from R1, we should see that all traffic is forwarded out Gi2.23 only.

<div align="left"><figure><img src="/files/IXbStwVfJKCz58zvGas6" alt=""><figcaption></figcaption></figure></div>

If we want, we can change the CEF load-sharing algorithm to include L4 flow information into the hash. This produces a different hop for each traceroute probe due to the different L4 port.

```
#R2
ip cef load-sharing algorithm include-ports source destination
```

<div align="left"><figure><img src="/files/7BW1Olg72iok7Q0Q1uYB" alt=""><figcaption></figcaption></figure></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ccie-sp.gitbook.io/ccie-spv5.1-labs/labs/ldp/ldp-and-ecmp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
