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

# Enable NWI strict routing table separation

## What it solves

Without strict routing, User Plane Gateway (UPG) uses a shared `Rx/Tx` table for User Equipment (UE) traffic on the Network Instance (NWI). UE traffic then shares the table that UPG uses for its own core network forwarding, which causes the following undesirable effects:
- All addresses in the NWI routing table are reachable from the UE side. This can be a security risk. For example, UE can reach the core NWI address of UPG itself.
- UE-to-UE traffic is forwarded locally inside UPG, but in some deployments, UE-to-UE traffic must leave the UPG node and be terminated upstream.

Strict routing gives you full control of UE traffic transmission and improves isolation by using a separate `Tx` table.

## How strict routing works

When `strictRouting` is enabled for an NWI, routes defined in the `networking.{INTERFACE}.ipv{4|6}.routes` section are installed in a separate `Tx` table instead of the shared `Rx/Tx` table.

As a result of this option:
- An automatically created `Rx` table is attached to the interface and used only for session matching and core network communication. The `Rx` table contains routes to directly-connected neighbors derived from the configured addresses, plus per-session routes pointing to the UPG plugin.
- UPG uses the `Tx` table for transmitting session traffic via the NWI. The `Tx` table contains only the routes from the `routes` section.

Ensure that the `routes` section covers every destination UE traffic needs to reach. Any destination not covered by the `routes` section is unreachable from the UE sessions.

## Configuration

Strict routing is opt-in. Enable it per interface when you need the table separation.

To enable strict routing table separation, set the `spec.instances.{NAME}.networking.{INTERFACE}.ipv{4|6}.strictRouting` field in the [UPGDeployment resource](https://docs.cennso.com/components/upg/latest/technical-reference/crds/UPGDeployment.md) on the Management Cluster for each NWI where you want strict routing enabled. See the example:

```yaml
spec:
  instances:
    inst01:
      networking:
        (...)
        sgi:
          interface: inet
          networkName: sgi-net
          ipv4:
            strictRouting: true
            addresses:
            - 192.0.2.2/24
            routes:
            - to: 0.0.0.0/0
              via: 192.0.2.1
          ipv6:
            strictRouting: true
            addresses:
            - 2001:db8::2/64
            routes:
            - to: ::/0
              via: 2001:db8::1
```

## Verification

First, check that separate [RoutingTable resources](https://docs.cennso.com/cennso/fpp/main/technical-reference/crds/RoutingTable.md) are created. To list them, use:

```bash
kubectl get routingtable -n {NAMESPACE}
```

You should see two `RoutingTable` resources for the NWI. The `Rx` table resource name has a `-rx` suffix. The other resource is the `Tx` table holding your configured routes.

To verify that the strict routing table separation is enabled, check if `ip4/6-table-id` is different from `tx-ip4/6-table-id` using the following VPP CLI command on the target Core Cluster:

```bash
vppctl sh upf nwi
```

See the output example:

```console
sgi default: ip4-table-id 200, ip6-table-id 200, tx-ip4-table-id 250, tx-ip6-table-id 250, ipfix-policy none, ipfix-collector-ip 0.0.0.0
```

Here, 200 is the `Rx` table and 250 is the `Tx` table.

## Interaction with GTP-U

Strict routing has limited value on GPRS Tunneling Protocol User Plane (GTP-U) NWIs because the GTP-U tunnel already isolates UE traffic. This feature is disabled in the UPG chart for GRX and SGI interfaces in GTP-U mode.

## Interaction with NAT

When strict routing is used with [basic NAT](https://docs.cennso.com/components/upg/latest/deployment-guides/basic-nat.md), the `Tx` table is used for the egress FIB lookup. NAT translation then runs as an output feature on the SGi interface. Strict routing is not implemented for [CG-NAT](https://docs.cennso.com/components/upg/latest/operation-guides/cg-nat.md) or [UPF NAT](https://docs.cennso.com/components/upg/latest/deployment-guides/upf-nat.md) in the UPG extension because both NAT types already perform a post-NAT transmit lookup.
