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.

Enable CG-NAT

Carrier-grade Network Address Translation (CG-NAT) is used by Internet service providers to allow multiple devices in private networks to share a limited number of public IP addresses, helping manage IPv4 address exhaustion.

User Plane Gateway (UPG) NAT allows the Control Plane to manage NAT binding allocation for user traffic. The CG-NAT feature, which handles large-scale network address translations, is only available in the TDF mode. UPG manages the NAT pools and reports their status to the Control Plane using PFCP messages, following the BBF WT-459.2 standard.

Terminology

These are key terms related to the CG-NAT feature:

  • CG-NAT (Carrier-Grade NAT): A large-scale NAT implementation optimised for handling a huge number of users.
  • Inbound: The side of the router facing the client whose addresses are translated.
  • Outbound: The side of the router, usually facing the Internet, with traffic after NAT translation.
  • i2o traffic: Traffic moving from the inbound (client) to the outbound (Internet) network, typically user uploads.
  • o2i traffic: Traffic moving from the outbound (Internet) to the inbound (client) network, typically user downloads.
  • NAT port block: A range of ports on an external IP endpoint dedicated to a single NAT allocation.
  • NAT endpoint: A router IP address in the outbound network used for NAT. Many NAT users share the same IP, but each has a different port block.
  • NAT binding: Links a NAT port block to a specific PFCP session.
  • NAT pool: A group of public IP addresses used for NAT in the same network.
  • NAT flow: A temporary connection state that tracks the mapping between internal and external IP:port pairs.

Architecture

Each session gets a single NAT binding from a specific NAT pool, which is named during session creation by the Control Plane. The NAT pool configuration includes the NWI, NAT endpoints, and port blocks allocated to those endpoints. The NAT pool uses the NWI interface to match and route outbound traffic.

NAT resources hierarchy
NAT resources hierarchy

UPG CG-NAT supports TCP, UDP, ICMP echo, and ICMP error messages. It tracks temporary port allocations in the flows table to handle translation and matching on translated addresses.

UPG CG-NAT flows are Endpoint-Dependent (ED), meaning a new flow is created for each destination IP:port pair. This type of NAT flows is commonly used for CG-NAT because it improves security by isolating flows and makes efficient use of ports.

For optimization, UPG CG-NAT uses two types of flows:

  • TCP/UDP flows: These are integrated into the UPG flows table and inherit its configuration.

  • ICMP flows: These can't be optimised like TCP/UDP flows, so they use a separate ICMP NAT flow table. ICMP flows have a limit on the number of flows per session to prevent RAM exhaustion, which can occur with aggressive port usage, such as port scanning. The default limit is 64 flows per session. You can change it using this CLI command:

    bash

NAT binding allocation

The NAT binding allocation process includes these steps:

  1. Available NAT pools are shared with the SMF node during the PFCP Association Setup Response.
  2. In the PFCP Session Establishment Request, SMF must indicate a NAT request with BBF Apply Action IE and provide the NAT pool name using BBF NAT Port Block IE.
  3. If the NAT binding is created successfully, UPG returns the assigned external IP and port block in the PFCP Session Establishment Response.
  4. If UPG fails to allocate a NAT binding, the PFCP Session Establishment Request is rejected, and a TP Error Report IE includes the failure reason, for example FAR ID <ID>, Error creating NAT binding for pool '<pool-name>': out of blocks.

Configuration

For a CG-NAT configuration example, see the Traffic Detection Function deployment guide.

Verification

To verify if CG-NAT is working correctly, check the following: