For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

Configure policy-based routing

Policy-based routing, also known as traffic steering, allows you to set routing rules for each session and forward traffic to different Data Networks, such as the Internet or a VPN. This feature requires Session Management ControllerBroken link (SMC) support in the PFCP Session Creation Request, using the Forwarding Policy IE (defined in 3GPP TS 29.244 V16.9.1 8.2.23).

Policy-based routing is supported only in the PGW use case. During session setup, SMC assigns a policy by adding the Forwarding Policy IE to the FAR(s) with the SGi-LAN or N6-LAN destination interface. For each session, one policy is applied, and traffic is forwarded based on a lookup in the relevant routing table. The UPG and SMC configurations must match, and SMC should send the correct policy IDs from the UPG configuration. A policy ID is a string (max 63 characters), such as defaultInet or defaultVpn.

Policy-based routing topology
Policy-based routing topology

Configuration

To configure policy-based routing:

  1. Create FPPNetworks for the SGi and VPN interfaces in the Core Cluster, independent from the UPGDeployment CR, which is applied to the Management Cluster. This enables cross-node connectivity to CGW Internet and CGW VPN. For the purpose of this tutorial, let's call them sgi-net and vpn-net. See the example:

    yaml
  2. Configure the SGi interface. The UPGDeployment CR creates a VPPInterface object for the SGi interface (like inet in the diagram), which is used for Internet connectivity. Sample configuration:

    yaml

    The resulting VPPInterface for the upg-pbr UPG deployment looks like this:

    yaml
  3. Create a separate VPPInterface for the VPN interface in the Core Cluster outside of the UPGDeployment CR:

    yaml

    The configuration assigns IPs to UPG's VPN memif interface, which connects to the vpn-net FPPNetwork. This interface uses table 200, which is the default routing table created by the UPGDeployment CR.

  4. Configure IPFIX to allow for sending IPFIX data over a VPP interface. First, configure IPFIX exporter:

    yaml

    Then, configure IPFIX for the SGi network in the spec.instances.{NAME}.networking section. See the example:

    yaml
  5. Define Forwarding Policies in the UPG configuration under spec.instances.{name}.forwardingPolicies. This creates UPGForwardingPolicy objects on the Core Cluster. Add the required table IDs in spec.instances.{name}.requiredRoutingTables to create empty IPv4 and IPv6 tables. If a routing table is deleted at runtime, the policy remains active, but traffic won’t be forwarded outside UPG until the table is restored.

    yaml

    This example configures policy-based routing with IPFIX activation per session. Different policies are defined, such as defaultInet and defaultInetIPFix. This allows SMC to decide whether to track traffic with IPFIX for each session or not. During PFCP session establishment, SMC selects one of the configured policies by name (for example, defaultInet or defaultInetIPFix) and includes it in the PFCP Session Establishment Request. The request contains the routing information in the FAR (Forwarding Action Rule), along with the selected IPFIX policy name provided in the TP IPFIX Policy IE (FlowUsage).

    Note

    If you are modifying an existing UPGDeployment, you must recreate the UPG pod to apply the updated VPP CLI configuration. See Reconfiguration at runtime for details.

  6. Define routing tables for the policies in a separate YAML file using the RoutingTable CR object. Configure routing tables connected to the policy tables in the Core Cluster, outside the UPGDeployment CR. Policy-based routing allows you to point the default route to the Internet and specific IP addresses to the VPN data network. You can also block specific IP ranges. Here's an example of routing table definitions:

    yaml

    The example shows different routes for tables 201 and 202. Table 201 routes default traffic to the Internet and specific addresses to the VPN data network. Table 202 does the opposite, sending default traffic to the VPN data network and forwarding specific routes to the SGi (Internet) network. IP 9.9.9.9/32 is blocked for both routes.

  7. For multiple UPG instances, define routingTableSelectors so that the same routing table object is applied to each UPG. The common label for all RoutingTable CRs is configured in the UPGDeployment CR as follows:

    yaml

For complete configuration details, see UPGDeployment CR examples for these configuration examples:

Verification

You can verify the policy-based routing configuration using the vppctl command in the UPG pod on the Core Cluster.

To verify that the SGi and VPN interfaces are configured correctly, run:

bash

Sample output:

txt

To verify that all routing tables exist, including the policy tables 201 and 202, run:

bash

Sample output:

txt

To verify that the forwarding policies are configured, run:

bash

Sample output:

txt