> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/fpp/3.2/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/fpp/3.2/operation-guides/abf.md).

# Configure ACL-based forwarding

Access Control List (ACL)-based forwarding (ABF) is a limited version of policy-based routing (PBR). It lets you forward a packet based on criteria other than their destination address, such as the source address.

When an ABF resource is bound to an interface, all incoming packets on that interface are evaluated against a set of ACL rules:
- Packets matching the ACL criteria are forwarded according to the specifications in the ABF object.
- Packets that do not match are routed using the standard routing process.

## VPPABF Custom Resources

To define ACL rules for ABF, use the [VPPABF Custom Resource](https://docs.cennso.com/components/fpp/3.2/concepts/vppabf.md) (CR).

It consists of three arrays:
  - **rules**
  - **bindings**
  - **forwarding**

VPPABF also contains a **required** label `fpp-manager.cennso.com/plumbing-instance` that must point to a VPP pod.

The minimal VPPABF example looks as follows:

```yaml
# Apply this on the Core Cluster
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPABF
metadata:
  name: test
  namespace: fpp
  labels:
    fpp-manager.cennso.com/created-for: node-op
    fpp-manager.cennso.com/plumbing-instance: cgw
spec:
  bindings:
    - ifName: srv
      priority: 0
  rules:
    - source: "198.19.1.0/24"
  forwarding:
    - lookupInTable: 100
```

This ABF matches all packets incoming on interface ***srv** from IPs matching range `198.19.1.0/24` on an instance `cgw` and tries to forward them by lookup in routing table 100.

### Rules
Rules are used to match traffic with a certain pattern and perform a defined action.
Each rule consists of an action and one or more optional parameters:

- **addressFamily** (optional) - Specifies the address family if it can't be deduced from the source or destination address
- **dest** (optional) - Destination Classless Inter-Domain Routing (CIDR)
- **dstPort** (optional) - Destination port range
- **protocol** (optional) - Defines the protocol. The possible values are `tcp`, `udp`, `sctp`, `icmp`, and `icmp6`.
- **source** (optional) - Source CIDR
- **srcPort** (optional) - Source port range

Source and destination port ranges are defined in the format of `1234-1235`.

CIDR addresses are defined in the formats of `192.168.0.0/24` or `2001:4860:4860::8888/32`.

Rules are shared with [VPPACL](https://docs.cennso.com/components/fpp/3.2/operation-guides/firewall.md#rules) object, except for action which does not make sense in this context, so is missing from configuration.

### Bindings
Before rules can start matching traffic, you must bind them to an interface using **bindings**.
Bindings contain a list of interfaces to which all the above rules will be applied.

Each binding consists of these parameters:

- **ifName** - Interface name as specified in the [VPPInterface CR](https://docs.cennso.com/components/fpp/3.2/concepts/vppinterface.md)
- **priority** - When multiple ABFs are bound to one interface, this parameter sets the order in which they match the incoming packets.

### Forwarding
This section lets you specify routing paths for the matched packets.

There are three possible values:
- **lookupInTable** - Perform lookup in this routing table ID
- **nextHopAddress** - Route packets to this next hop
- **nextHopInterface** - Route packets using this interface. The name should be as specified in the VPPInterface CR.

When multiple path entries are provided, VPP balances the matched packets between them.

## Verification

After applying a `VPPABF` resource, you can verify the ABF configuration in the VPP container in the Core Cluster.

To verify ABF policies, run the following command:

```bash
vppctl show abf policy
```

The output shows the configured ABF policy with its forwarding path:

```
abf:[0]: policy:0 acl:0
     path-list:[52] locks:1 flags:shared,no-uRPF,
      path:[58] pl-index:52 ip4 weight=1 pref=0 deag:  oper-flags:resolved,
         fib-index:1
```

To verify ABF bindings on a specific interface, run:

```bash
vppctl show abf attach srv
```

The output shows the ABF attachment with the configured priority:

```
ipv4:
 abf-interface-attach: policy:0 priority:0
  [@3]: dst-address,unicast lookup in ipv4-VRF:100
```

To verify the ACL rules associated with ABF, run:

```bash
vppctl show acl-plugin acl
```

The output shows the ACL rule that matches the `VPPABF` spec:

```
acl-index 0 count 1 tag {abf/854cd527-c544-43b4-bbd2-5cb625093edc/0}
  0: ipv4 permit src 198.19.1.0/24 dst 0.0.0.0/0 proto 0 sport 0-65535 dport 0-65535
```

## Limitations

- VPP ABFs cover only TCP/UDP/ICMP L4 protocols
