> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/rpr/3.0/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/rpr/3.0/configuration/aaa-forwarding.md).

# Forwarding of the AAA RADIUS requests

The RADIUS Proxy (RPR) configuration consists of a list of RADIUS Proxy servers and associated relay servers. Each RADIUS Proxy server specifies a RADIUS listener where incoming RADIUS requests are received. Each relay specifies a RADIUS server where RADIUS Proxy forwards the incoming RADIUS requests.

RADIUS Proxy supports both Authentication and Accounting RADIUS servers. All the Authentication and Accounting RADIUS servers must be configured in one of the following groups:

- `auth` - the list of RADIUS Authentication servers.
- `acct` - the list of RADIUS Accounting servers.

Each RADIUS Authentication proxy server must be configured as `auth.{SERVER_NAME}.*` and each RADIUS Accounting proxy server must be configured as `acct.{SERVER_NAME}.*`. The proxy servers may have the following configuration options:

>**NOTE:** All the configuration options are prefixed with **auth.**, but they are also applicable to the RADIUS Accounting servers configured with the **acct.** prefix.

- `auth.{SERVER_NAME}.listen` - the RADIUS server listener address.
- `auth.{SERVER_NAME}.ports` - the list of ports at which RADIUS servers listen for incoming messages. It is recommended to use port `1812` for the RADIUS Authentication server and port `1813` for the RADIUS Accounting server.
- `auth.{SERVER_NAME}.sources` - the list of sources from where the given RADIUS server accepts incoming RADIUS messages. If a RADIUS message is from an unknown source, the message is silently dropped by the RADIUS server. Each source must provide a RADIUS secret, the source address or range of addresses in the `address/mask` format, and the optional `nas_id` value. The `nas_id` parameter specifies the Network Access Server (NAS) identifier. If `nas_id` is specified, it is used as a value of the `nas_id` label. For more information, see the [RADIUS server metrics](https://docs.cennso.com/components/rpr/3.0/observability/metrics.md#radius-server-metrics).

   >**CAUTION:** Most RADIUS metrics have labels that specify the NAS name and source IP of the incoming request. Setting wide IP ranges in `auth.{SERVER_NAME}.sources`, `acct.{SERVER_NAME}.sources`, or `coa.sources` may lead to high resource consumption and performance degradation.

- `auth.{SERVER_NAME}.allow_attrs` - the list of RADIUS attributes to preserve in the forwarded request. If the list is empty, RADIUS Proxy doesn't preserve any attributes. Otherwise, only the RADIUS attributes from the list are preserved.
- `auth.{SERVER_NAME}.relays` - the list of RADIUS relays where RADIUS Proxy forwards the incoming RADIUS requests. Each relay must have an address and a RADIUS secret specified. If instead of an IP address, the FQDN name is given in the `relay` configuration, and it can be assigned to multiple IP addresses, RPR distributes requests to all of them in a random order. RADIUS Proxy uses realms to determine where to forward the given RADIUS request. A realm is a part of the [User-Name](https://www.rfc-editor.org/rfc/rfc2865#section-5.1) RADIUS attribute provided in the [Network Access Identifier](https://www.rfc-editor.org/rfc/rfc2486#section-2.4) format. If a realm is not specified in the RADIUS relay configuration, RPR uses such a relay as a default relay where all requests are forwarded if the suitable relay is not found.

  >**NOTE:** Each RADIUS server that is configured in RADIUS Proxy must have only one default relay.

- `auth.{SERVER_NAME}.relays.{RELAY}.timeout` - the number of milliseconds RADIUS Proxy waits for the response. If not specified in the configuration, the default value of `5000` is used.
- `auth.{SERVER_NAME}.relays.{RELAY}.retries` - the number of tries to re-send a RADIUS request failed by timeout to the given RADIUS relay. If not specified, the default value of `3` is used. If the number of retries for a primary RADIUS server is exhausted, the failover RADIUS servers are used. Only after that, the client returns a response or an error. For more information, see the [RADIUS servers for failover scenarios](https://docs.cennso.com/components/rpr/3.0/configuration/failover-servers.md) document.
- `auth.{SERVER_NAME}.relays.{RELAY}.failover_server_pool` - the name of a pool of secondary RADIUS servers used for failover scenarios. For more information, see the [RADIUS servers for failover scenarios](https://docs.cennso.com/components/rpr/3.0/configuration/failover-servers.md) document.

See the configuration example:

```yaml
auth:
  proxy_auth_1:
    listen: 0.0.0.0
    ports:
      - 1812
    sources:
      - secret: "secret"
        source: 172.16.2.1
        nas_id: PGW1
      - secret: "secret"
        source: 172.16.2.2
        nas_id: PGW2
      - secret: "secret"
        source: 172.16.2.3
        nas_id: PGW3
    allow_attrs: []
    relays:
      - address: "radius-server-1-host:1812"
        secret: "secret"
        timeout: 5000
        retries: 3
      - address: "radius-server-2-host:1812"
        realm: pgw-nas
        secret: "secret"

acct:
  proxy_acct_1:
    listen: 0.0.0.0
    ports:
      - 1813
    sources:
      - secret: "secret"
        source: 172.16.2.1
        nas_id: PGW1
    relays:
      - address: "radius-server-1-host:1813"
        secret: "secret"
```

The Authentication RADIUS server listens for the incoming RADIUS requests on the port `1812` and accepts the incoming RADIUS requests from the RADIUS servers that are located at the `172.16.2.1`, `172.16.2.2`, and `172.16.2.3` addresses. Besides, only requests with the given `secret` are accepted. The list of allowed RADIUS attributes specified under `allow_attrs` is empty by default, so no filters are applied to the incoming RADIUS requests. All of the incoming RADIUS requests are forwarded to one of these relays:

- `radius-server-1-host:1812`
- `radius-server-2-host:1812`

The server where RADIUS Proxy forwards the given incoming RADIUS request depends on the content of the request. If the incoming RADIUS request has the `pgw-nas` realm in the `User-Name` attribute, RADIUS Proxy forwards such requests to the `radius-server-2-host:1812` RADIUS server. Otherwise, the default relay `radius-server-1-host:1812` without the specified realm is used.

The Accounting RADIUS server listens for the incoming RADIUS requests on the port `1813` and accepts the incoming RADIUS requests from the `172.16.2.1` RADIUS server. All the incoming RADIUS requests are forwarded to the default relay - `radius-server-1-host:1813`.
