# Migrate LDP to SR (ISIS)

Load **basic.isis.ldp.enabled.cfg**

```
configure
load bootflash:basic.isis.ldp.enabled.cfg
commit replace
y
```

Currently the core is using LDP only. Convert the core to SR only without any traffic disruption.

## Answer <a href="#id-9bfc5f0e-8526-43e5-9234-8e06c1cd82ab" id="id-9bfc5f0e-8526-43e5-9234-8e06c1cd82ab"></a>

Step 1) We add SR to all nodes. By default, the LDP label will still be preferred, so this doesn’t result in any change in the data plane. Only R1 is shown for brevity:

```
#R1
router isis 1
 add ipv4
  segment-routing mpls
 int lo1
  add ipv4
   prefix-sid index 1
```

\
We can see that the SR label table is now populated:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FIyDd9rG95KDH4GAQ5yH7%2Fimage.png?alt=media&#x26;token=e703e379-f68b-484c-a7a4-7c5d06435ebe" alt=""><figcaption></figcaption></figure></div>

SR to SR label swap entries have been added to the LFIB:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FdmLLh5Ea1KDX4B1jUL7p%2Fimage.png?alt=media&#x26;token=9ce6b632-0dcd-45eb-a0e9-746e2d657e5b" alt=""><figcaption></figcaption></figure></div>

However, none of these will be used right now, because all routers are still imposing LDP labels on IP packets. We can verify this by checking the FIB for any prefix:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2Fyjt9BxO26XcarMdKO0tm%2Fimage.png?alt=media&#x26;token=e42c04b3-8022-469c-a802-7ccf52623896" alt=""><figcaption></figcaption></figure></div>

Step 2) We change the label imposition to SR labels rather than LDP labels. This can be done on a router-by-router basis. Only R1 is shown for brevity:

```
#R1
router isis 1
 add ipv4
  segment-routing mpls sr-prefer
```

The label imposed is now the SR label:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FTQi2XCD3auYbRxZlY2Pw%2Fimage.png?alt=media&#x26;token=a257afa4-9ae8-4992-9f92-f8a8c4a68301" alt=""><figcaption></figcaption></figure></div>

This can be done router-by-router with no issues. Only the ingress LER controls whether the LDP or SR label path is used. LSRs will switch SR labels to SR labels and LDP labels to LDP labels.

Step 3) Once all routers are imposing SR labels via the **sr-prefer** command, we can begin removing LDP. First we’ll remove LDP/IGP sync from the ISIS apply group. (If you remove LDP first, the IGP will be affected as the IGP costs will change).

```
#R1
group ISIS
 router isis '1'
  interface 'GigabitEthernet.*'
   address-family ipv4 unicast
    no mpls ldp sync
end-group
```

Step 4) Now we remove LDP from all routers one by one.

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

### Summary <a href="#id-17787acc-74af-4f30-afc9-526c00b04987" id="id-17787acc-74af-4f30-afc9-526c00b04987"></a>

Cisco’s default preference for LDP label imposition gives us a graceful way to migrate to SR. First, SR is enabled everywhere, but is not actually “in use” yet because LDP labels are still being imposed. This allows us to first verify SR and perhaps use OAM to verify SR LSPs before SR is actually used.

Next, we use **sr-prefer** to start enabling SR. This can be done on a router-by-router basis. The ingress LER controls whether an LDP or SR label is imposed. Make sure you have enabled SR everywhere before doing this.

Finally, we can remove LDP. We first removed LDP/IGP sync to prevent max-metrics on interfaces, and then removed LDP altogether.
