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.
Configuration
To configure policy-based routing:
Create FPPNetworks for the SGi and VPN interfaces outside the UPG chart. This enables cross-node connectivity to CGW Internet and CGW VPN. For the purpose of this tutorial, let's call them
sgi-netandvpn-net. See the example:yamlCreate an SGi interface. Use a regular SGi interface (like
inetin the diagram) for Internet connectivity. The chart creates a Network Attachment Definition (NAD) forinet.Create a separate NAD for the VPN interface outside of the UPG chart:
yamlThe configuration assigns IPs to UPG's VPN memif interface, which connects to the
vpn-netFPPNetwork. This interface uses table 200, the default routing table created by the UPG chart.Define an additional interface in the UPG deployment for VPN connectivity using the additionalNetworks section under instances.{name}.networking. Add this NAD (
vpn21-memif-inst01) to additionalNetworks in the per-instance network configuration:yamlConfigure IPFIX to allow for sending IPFIX data over a VPP interface. First, configure IPFIX exporter:
yamlThen, configure IPFIX for the SGi network in the instances.{NAME}.networking section. See the example:
yamlDefine policy names in the UPG configuration under instances.{name}.additionalConfig. Use CLI
upf policy add id {POLICY_NAME}commands in this section to define forwarding policies. Add the required table IDs in 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.yamlThis example configures policy-based routing with IPFIX activation per session. Different policies are defined, such as
defaultInetanddefaultInetIPFix. This allows SMC to decide, for each session, whether to track traffic with IPFIX or not. SMC sends a PFCP Session Establishment Request with the IEs for routing (FAR—forwarding action rule) including the IPFIX policy name (TP IPFIX Policy IE—FlowUsage) —defaultInetordefaultInetIPFix.Define routing tables for the policies in a separate YAML file using the RoutingTable CR object. Configure routing tables connected to the policy tables outside the UPG chart. 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:
yamlThe 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/32is blocked for both routes.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 UPG chart as follows:
yaml
For complete configuration details, see values.yaml files for these configuration examples: