# RPKI on IOS-XR (VRF)

Load **ios-xr.rpki.vrf.init.cfg**

```
#IOS-XE (R6)
config replace flash:ios-xr.rpki.vrf.init.cfg

#IOS-XR (XR1, XR2)
configure
load bootflash:ios-xr.rpki.vrf.init.cfg
commit replace
y
```

<figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FqhLBNMwexr21lnxG4SxW%2Fimage.png?alt=media&#x26;token=cd0642e7-ed09-49f6-8a1e-40b6a5e8a378" alt=""><figcaption></figcaption></figure>



BGP is already setup between XR1-R6 and XR1-XR2.



Configure RPKI on XR1 for both IPv4 and IPv6. Reject all invalid paths. XR1 is running internet in a VRF called INET.



The RPKI server is reachable in the global table at 10.100.100.1 on port 22. Use SSH as the transport with rpki/rpki.













































## Answer <a href="#f8cda23c-8975-47c2-8f9d-0f364d26ed82" id="f8cda23c-8975-47c2-8f9d-0f364d26ed82"></a>

```
#XR1
router bgp 1245
 rpki server 10.100.100.1
  username rpki
  password rpki
  transport ssh port 22
 !
 vrf INET
  address-family ipv4 unicast
   bgp origin-as validation enable
   bgp bestpath origin-as use validity
  !
  address-family ipv6 unicast
   bgp origin-as validation enable
   bgp bestpath origin-as use validity
```



## Explanation <a href="#id-9b05a406-eb61-455a-9bc6-e8f38341eb5d" id="id-9b05a406-eb61-455a-9bc6-e8f38341eb5d"></a>

IOS-XR allows us to use RPKI origin validation in a VRF instead of just the global table. This allows us to run INET in a VRF, which is a popular option among service providers. This keeps the global table limited to just internal loopbacks and underlay transit prefixes.



Enabling RPKI for a VRF is quite simple, you just enable the configuration under the VRF AFIs instead of under the global AFIs. The RPKI server is configured the same way. Note that if you’d like, you can source the RPKI connection from an interface in a VRF using the **bind-source** command.



On XR1 we can see that invalid paths are being rejected for IPv4 and IPv6 routes in the INET VRF.

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2F0ITLSTsXZt4hdD5SpAjl%2Fimage.png?alt=media&#x26;token=50382b59-a5ca-4924-a65b-9de5ef4bc302" alt=""><figcaption></figcaption></figure></div>



Note that this functionality does not appear to be available on IOS-XE. I do not see a way to enable origin-as validation within a VRF on CSR1000v.
