> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/fpp/latest/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/latest/operation-guides/span-config.md).

# Configure SPAN mappings

SPAN mapping can be configured on any `VPPInterface` by adding `spanSource` field to its spec. SPAN mappings work by applying SPAN settings that tell VPPSwitch to copy all of the traffic targeted towards the interface mentioned in `spanSource` towards the interface for which that `spanSource` is set in its spec. The `VPPInterface` and `NetworkAttachmentDefinition` CRs used in this guide are created on the Core Cluster.

`spanSource` can be defined in one of three ways:

1. By specifying the name of a particular VPPInterface
1. By specifying a set of labels that match a single VPPInterface
1. By specifying the name and namespace of a CNI-less slave memif

You can use all the above methods manually on the VPPInterface definition or automatically through the FPP-CNI configuration in **NetworkAttachmentDefinition**.

## VPPInterface object name

Sample definition of a tap interface with a SPAN source from another interface specified using name:

```yaml
# Apply this on the Core Cluster
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPInterface
metadata:
  labels:
    fpp-manager.cennso.com/created-for: node-op
    fpp-manager.cennso.com/plumbing-container-id: 92b86f0e629c10966389ee1acfd9fff6e445147c
    fpp-manager.cennso.com/plumbing-ifname: net1
    fpp-manager.cennso.com/plumbing-instance-uid: 4b879b86-3789-421e-a636-caafec73a6ba
    fpp-manager.cennso.com/plumbing-node: fpp-cluster-control-plane
    fpp-manager.cennso.com/plumbing-pod-name: linux-app-0
    fpp-manager.cennso.com/plumbing-type: tap
    fpp-manager.cennso.com/plumbing-vni: "1"
  name: linux-app-0-tap-1-b4v8g
  namespace: fpp-sample
spec:
  bridgeDomain: 1
  hardwareAddress: 02:fe:12:d9:3f:ff
  ifName: tst
  mtu: 9000
  tap:
    hostIfName: net1
    hostNS: /var/run/netns/cni-3ab3b5f8-de69-93d1-8dba-b1333ee01e32
  spanSource:
    name: linux-app-1-tap-0-a298f
```

## Matching label of source VPPInterface

Sample definition of a tap interface with the SPAN source specified using labels:

```yaml
# Apply this on the Core Cluster
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPInterface
metadata:
  labels:
    fpp-manager.cennso.com/created-for: node-op
    fpp-manager.cennso.com/plumbing-container-id: 92b86f0e629c10966389ee1acfd9fff6e445147c
    fpp-manager.cennso.com/plumbing-ifname: net1
    fpp-manager.cennso.com/plumbing-instance-uid: 4b879b86-3789-421e-a636-caafec73a6ba
    fpp-manager.cennso.com/plumbing-node: fpp-cluster-control-plane
    fpp-manager.cennso.com/plumbing-pod-name: linux-app-0
    fpp-manager.cennso.com/plumbing-type: tap
    fpp-manager.cennso.com/plumbing-vni: "1"
  name: linux-app-0-tap-1-b4v8g
  namespace: fpp-sample
spec:
  bridgeDomain: 1
  hardwareAddress: 02:fe:12:d9:3f:ff
  ifName: tst
  mtu: 9000
  tap:
    hostIfName: net1
    hostNS: /var/run/netns/cni-3ab3b5f8-de69-93d1-8dba-b1333ee01e32
  spanSource:
    matchingLabels:
      fpp-manager.cennso.com/plumbing-pod-name: linux-app-1
      fpp-manager.cennso.com/plumbing-vni: "1"

```

Example FPP-CNI NAD with SPAN configuration:

```yaml
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: linux-net
  namespace: fpp-sample
spec:
  config: |-
    {
      "cniVersion": "0.3.0",
      "ipam": {
        "addresses": [
          {
            "address": "10.0.0.2/24"
          }
        ],
        "type": "static"
      },
      "mtu": 9000,
      "name": "tst",
      "type": "fpp-cni",
      "vni": 1,
      "vppIfaceType": "tap",
      "spanSource": {
        "matchingLabels": {
          "fpp-manager.cennso.com/plumbing-pod-name": "linux-app-1",
          "fpp-manager.cennso.com/plumbing-vni": "1"
        }
      }
    }
```

## VPPInterfaceRef for CNI-less SPANs

When the CNI-less feature is used, the SPAN source interface is not visible as a Kubernetes API object.

In this case, you must define **vppInterfaceRef** in the **spanSource** section when defining a Network Attachment Definition:

```yaml
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: span-upg-sxb
spec:
  config: |-
    {
      "cniVersion": "0.3.0",
      "ipam": {},
      "mtu": 9000,
      "name": "span-upg-sx",
      "type": "fpp-cni",
      "vni": 1,
      "vppIfaceType": "tap",
      "spanSource": {
        "vppInterfaceRef": {
          "name": "upg-sample-sxb",
          "namespace": "upg-test"
        }
      }
    }
```

The **vppInterfaceRef** section must include the **name** and the **namespace** of the slave memif VPPInterface CR.

## Verification

After creating the SPAN interface, you can describe the created `VPPInterface` object using **kubectl** and check if the `VPPSPANSourceSet` event is present, for example:

```bash
kubectl describe vppinterfaces.fpp-manager.cennso.com -n pgw-ocs upg-span-0-tap-1-zdbd7
```

Sample output:

```yaml
Name:         upg-span-0-tap-1-zdbd7
Namespace:    pgw-ocs
Labels:       fpp-manager.cennso.com/created-for=vpp-operator
              fpp-manager.cennso.com/plumbing-container-id=4bb5a3cfa3d29807c1280dd187c506f8de6115a4
              fpp-manager.cennso.com/plumbing-ifname=sxb
              fpp-manager.cennso.com/plumbing-instance-uid=94d16ae8-30c2-4215-996e-ed94bf5342ca
              fpp-manager.cennso.com/plumbing-node=fpp-cluster-worker
              fpp-manager.cennso.com/plumbing-pod-name=upg-span-0
              fpp-manager.cennso.com/plumbing-type=tap
              fpp-manager.cennso.com/plumbing-vni=1
              fpp-manager.cennso.com/slice=default
API Version:  fpp-manager.cennso.com/v1alpha1
Kind:         VPPInterface
Metadata:
  Creation Timestamp:  2026-02-18T10:03:47Z
  Finalizers:
    fpp-manager.cennso.com/vpp-interface-finalizer-vpp-operator
  Generate Name:  upg-span-0-tap-1-
  Generation:     2
  ...
Spec:
  Bridge Domain:     1
  Hardware Address:  02:fe:eb:ad:15:a0
  If Name:           tap1-sxb
  Mtu:               9000
  Span Source:
    Vpp Interface Ref:
      Name:       upg-prox01-sxb
      Namespace:  pgw-ocs
  Tap:
    Host If Name:  sxb
    Host NS:       /var/run/netns/cni-48009350-84a5-9fa3-7555-acb3235033d0
Status:
  Member Count:  0
  Ready:         true
  Sw If Index:   14
  Vpp Name:      tap1-sxb
Events:
  Type    Reason             Age    From          Message
  ----    ------             ----   ----          -------
  Normal  VPPSPANSourceSet   2m41s  VPPInterface  VPP SPAN source set
  Normal  VPPInterfaceAdded  2m41s  VPPInterface  VPP interface added
```

To further verify the setup, access a Linux pod associated with the VPP interface and use a tool like **tcpdump** to monitor traffic mirrored from the source VPP interfaces. For example:

```bash
tcpdump -i sxb
```

Sample output:

```
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on sxb, link-type EN10MB (Ethernet), capture size 262144 bytes
10:15:32.735359 IP 172.20.0.10.34391 > 172.20.0.20.8805: UDP, length 16
10:15:32.738755 IP 172.20.0.20.8805 > 172.20.0.10.34391: UDP, length 16
^C
2 packets captured
2 packets received by filter
0 packets dropped by kernel
```

We can see 2 packets (PFCP Heartbeat) exchanged between UPG and SMC in the above output.
