> For the complete documentation index, see [llms.txt](https://ccie-sp.gitbook.io/ccie-spv5.1-labs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ccie-sp.gitbook.io/ccie-spv5.1-labs/labs/ldp/ldp-inbound-label-advertisement-filtering.md).

# LDP Inbound Label Advertisement Filtering

Load **isis.cfg**

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

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

* Configure LDP using LDP autoconfig under ISIS
* Configure inbound label filtering on R1 and XR2 to filter out label bindings received from their LDP neighbors for all transit prefixes

## Answer <a href="#id-82b96419-0158-4e14-b7ac-d322bb979516" id="id-82b96419-0158-4e14-b7ac-d322bb979516"></a>

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

#R1
ip access-list standard LDP_FILTER_IN
 deny 10.0.0.0 0.255.255.255
 permit host 20.20.20.20
 deny 20.0.0.0 0.255.255.255
 permit any
!
mpls ldp neighbor 2.2.2.2 labels accept LDP_FILTER_IN

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

#XR2
ipv4 access-list LDP_FILTER_IN
 10 deny ipv4 10.0.0.0/8 any
 20 permit ipv4 host 20.20.20.20 any
 30 deny ipv4 20.0.0.0/8 any
 40 permit ipv4 any any
!
mpls ldp
 address-family ipv4
  label
   remote
    accept
     from 19.19.19.19:0 for LDP_FILTER_IN
```

## Explanation <a href="#cea49921-4c11-4f4f-93f1-b10f2d996998" id="cea49921-4c11-4f4f-93f1-b10f2d996998"></a>

Inbound LDP advertisement filtering is much easier to configure than outbound advertisement filtering. In both IOS-XE and IOS-XR, we must apply an ACL on a per-neighbor basis to filter incoming LDP bindings.

On IOS-XE, we use the following command:

```
#IOS-XE
mpls ldp neighbor RID labels accept ACL
```

On IOS-XR, we use the following command:

```
#IOS-XR
mpls ldp
 address-family ipv4
  label
   remote
    accept
     from RID:0 for ACL
```

## Verification <a href="#id-72976356-7a16-445d-90b8-e91a52fade3b" id="id-72976356-7a16-445d-90b8-e91a52fade3b"></a>

On R1, since R2 is the only LDP peer, we can look at the LDP bindings summary for a quick check that the inbound filtering is working. Before implementing the filter, we see that we have one remote binding for every prefix:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2F2mxQOFgFypz64G7epkOF%2Fimage.png?alt=media&amp;token=d9f6a11b-0761-4398-a9dd-cedab818857f" alt=""><figcaption></figcaption></figure></div>

After implementing the filter, we should only see a remote binding for the /32 loopbacks, due to our standard ACL we are applying for R2:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FnfTHPkrB8KfxdwYQW43N%2Fimage.png?alt=media&amp;token=e7b4475e-73d2-4ea1-aea9-98244ceb85da" alt=""><figcaption></figcaption></figure></div>

Likewise, on XR2, we can use the same command. First we verify that we are receiving one remote label (from XR1) for every prefix:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FxMgt2rtOh0Vmv55UOzjg%2Fimage.png?alt=media&amp;token=599a7f77-a2cb-4073-a503-06f3e74d6695" alt=""><figcaption></figcaption></figure></div>

Next, we apply the inbound filter and verify that XR2 has discarded XR1’s bindings for non-loopback prefixes:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2Fi0hFSLhY8cI7cF7hfPEq%2Fimage.png?alt=media&amp;token=1720b7ef-d8a8-4aa5-acc7-e3307db30234" alt=""><figcaption></figcaption></figure></div>
