# SRv6 uSID w/ Dual-Connected PE

Load **top1.vpnv4v6.srv6.dual.pe.init.cfg**

```
#IOS-XR
configure
load top1.vpnv4v6.srv6.dual.pe.init.cfg
commit replace
y

#IOS-XE
config replace flash:top1.vpnv4v6.srv6.dual.pe.init.cfg
```



All routers are running both SR-MPLS and SRv6. The PEs are only using MPLS for the L3VPN.



Configure the PEs for dual-support of MPLS and SRv6. Use XR9 for MPLS VPN routes only, and XR10 for SRv6 VPN routes only. Once all four PEs are configured with support for both MPLS and SRv6, flip over to using SRv6 as the encapsulation instead of MPLS.













































## Answer <a href="#id-10fab814-8f7b-4c92-b394-3aadd35acd09" id="id-10fab814-8f7b-4c92-b394-3aadd35acd09"></a>

```
# Step 1 - Enable SRv6 but still prefer MPLS by using LP
#
# XR5, XR6, XR7, XR8
route-policy SET_LP($LP)
 set local-preference $LP
end-policy
!
router bgp 100
 segment-routing srv6
  locator CCIE
 !
 neighbor 2001:db8:200::a
  address-family vpnv4 unicast
   encapsulation-type srv6
   route-policy SET_LP(90) out
  address-family vpnv6 unicast
   encapsulation-type srv6
   route-policy SET_LP(90) out
 !
 vrf CUSTOMER
  address-family ipv4 unicast
   mpls alloc enable
   segment-routing srv6
    alloc mode per-vrf
  !
  address-family ipv6 unicast
   mpls alloc enable
   segment-routing srv6
    alloc mode per-vrf

# Step 2 - Set LP higher on the SRv6 routes to prefer them over MPLS
#
# XR5, XR6, XR7, XR8
router bgp 100
 neighbor 2001:db8:200::a
  address-family vpnv4 unicast
   route-policy SET_LP(110) out
  address-family vpnv6 unicast
   route-policy SET_LP(110) out
```



## Explanation <a href="#id-87f31f15-9d00-4981-b207-fcea2849c576" id="id-87f31f15-9d00-4981-b207-fcea2849c576"></a>

Instead of using an IWG, another option for migration from MPLS to SRv6 is to use dual-connected PEs. This reminds me of migrating LDP to SR. First LDP is enabled everywhere. Then you enable SR alongside LDP, but continue pushing only LDP labels. Then you change the label imposition to SR.



In this lab, SR-MPLS and SRv6 are already enabled. By default, BGP L3VPN will only use MPLS labels. To enable support for SRv6 _and_ MPLS, we must tell BGP to allocate an MPLS label, plus use SRv6 for the VRF:

```
router bgp 100
 segment-routing srv6
  locator CCIE
 !
 vrf CUSTOMER
  address-family ipv4 unicast
   mpls alloc enable
   segment-routing srv6
    alloc mode per-vrf
  !
  address-family ipv6 unicast
   mpls alloc enable
   segment-routing srv6
    alloc mode per-vrf
```



When both MPLS and SRv6 SIDs are allocated, by default only the MPLS label is advertised. We also tell the router to use SRv6 SIDs as the encapsulation when advertising the VPN routes to XR10. When using a dual-connected PE for migration from SR-MPLS to SRv6, you typically want to have a separate RR for each encapsulation type to make the transition easier.

```
router bgp 100
 neighbor 2001:db8:200::a
  address-family vpnv4 unicast
   encapsulation-type srv6
  !
  address-family vpnv6 unicast
   encapsulation-type srv6
```



Lastly, we set LP lower so that the SRv6 routes are not used yet.

```
route-policy SET_LP($LP)
 set local-preference $LP
end-policy
!
router bgp 100
 neighbor 2001:db8:200::a
  address-family vpnv4 unicast
   route-policy SET_LP(90) out
  !
  address-family vpnv6 unicast
   route-policy SET_LP(90) out
```



Now that step 1 is complete, we can verify that SRv6 SID advertisement is working correctly before we actually use it. We first see that all routes via the XR10 RR have a lower LP:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FR4Sh64L2LHyPYIS5QYAL%2Fimage.png?alt=media&#x26;token=b701fb94-d06e-41e9-8998-e3c7eaacf746" alt=""><figcaption></figcaption></figure></div>



The VPN routes via XR10 have an SRv6 SID, while the routes via XR9 still only have an MPLS label:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FznDndSJJ6HGTD39tePgH%2Fimage.png?alt=media&#x26;token=f9bdb504-a57e-4fd7-b6cd-2f3c6516a7f4" alt=""><figcaption></figcaption></figure></div>



All L3VPN routes still use MPLS encapsulation:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FCy1ellq81KqTBUfJCAvn%2Fimage.png?alt=media&#x26;token=8cfae38c-d921-41a2-9b6a-db30c077c9a6" alt=""><figcaption></figcaption></figure></div>



Next, we set LP on the SRv6 routes to 110 to prefer them over the MPLS service routes.

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FpoBqpVULnX1vf9mEYMej%2Fimage.png?alt=media&#x26;token=3401de3b-349e-47ae-bfb9-9b5b6baa92d3" alt=""><figcaption></figcaption></figure></div>



Traffic now uses SRv6 encapsulation:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FXQBg8BxCExQM2H29fxMJ%2Fimage.png?alt=media&#x26;token=d5544bde-6ec8-4c19-8c9c-f08e23c449cb" alt=""><figcaption></figcaption></figure></div>



Similar to the LDP to SR migration, we can “flip the switch” and not incur any outage at all, as the control plane is fully setup for both SR-MPLS and SRv6 at the same time. If we needed to revert, we simply use LP to move back to using SR-MPLS encapsulation again.
