> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/smc/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/smc/latest/guides/aaa/authentication/radius.md).

# RADIUS Authentication and Accounting

## Overview

RADIUS (Remote Authentication Dial-In User Service) is an AAA protocol specified in [IETF RFC 2865](https://www.rfc-editor.org/rfc/rfc2865.html) (Authentication) and [RFC 2866](https://www.rfc-editor.org/rfc/rfc2866.html) (Accounting). As a true AAA protocol, RADIUS handles:

- **Authentication** - Verify user identity before network access
- **Authorisation** - Determine what services a user can access
- **Accounting** - Track session events for operational purposes

> [!IMPORTANT]
> RADIUS serves two distinct purposes in SMC:
> 1. **AAA** (documented here) - Identity verification and operational session tracking
> 2. **Charging** - Billing data collection (see [RADIUS Charging](https://docs.cennso.com/components/smc/latest/guides/aaa/charging/radius.md))
>
> While both use the same RADIUS protocol and configuration, they serve different business concerns.

This document covers RADIUS as a **true AAA** protocol. For RADIUS used for billing and charging, see [RADIUS Charging](https://docs.cennso.com/components/smc/latest/guides/aaa/charging/radius.md).

References:
- [IETF RFC 2865](https://www.rfc-editor.org/rfc/rfc2865.html) - RADIUS Authentication
- [IETF RFC 2866](https://www.rfc-editor.org/rfc/rfc2866.html) - RADIUS Accounting
- [AAA Overview](https://docs.cennso.com/components/smc/latest/guides/aaa/overview.md) - Understanding AAA vs Policy vs Charging

## Basic Configuration

Enable RADIUS and configure the server:

```yaml
aaa:
  radius:
    enabled: true
    server:
      addr: "192.168.1.100"
      type: "ipv4"  # ipv4, ipv6, or fqdn
      password: "sharedsecret"
      auth:
        port: 1812
      acct:
        port: 1813
```

Attributes:
- `enabled` - Enable or disable RADIUS
- `server.addr` - RADIUS server address (IPv4, IPv6, or FQDN)
- `server.auth.port` - RADIUS authentication port (standard: 1812)
- `server.acct.port` - RADIUS accounting port (standard: 1813)
- `server.type` - Address type: `ipv4`, `ipv6`, or `fqdn`
- `server.password` - Shared secret for RADIUS message authentication

## Authentication Configuration

### Enable Authentication

When authentication is enabled, SMC sends Access-Request messages to the RADIUS server before establishing user sessions. Sessions are only established if the server responds with Access-Accept.

```yaml
aaa:
  radius:
    enabled: true
    authenticate:
      enabled: true  # Enable RADIUS authentication
    server:
      addr: "192.168.1.100"
      type: "ipv4"
      password: "sharedsecret"
      auth:
        port: 1812
```

### Authentication Flow

1. **User requests session** - UE sends Create Session Request (GTP) or Session Establishment Request (PFCP)
2. **SMC sends Access-Request** - Contains IMSI, IMEI/IMEISV, APN/DNN, location
3. **RADIUS server validates** - Checks subscriber database, applies business logic
4. **Server responds**:
   - **Access-Accept** - Session is established, may include authorisation attributes
   - **Access-Reject** - Session is rejected, user denied access
   - **Access-Challenge** - Additional authentication required (not commonly used in mobile networks)
5. **SMC processes response** - Establishes or rejects session based on server response

### Authorisation via Access-Accept

RADIUS Access-Accept messages can contain authorisation attributes that control session parameters:

**Common authorisation attributes:**
- `Framed-IP-Address` - Assign specific IP address to user
- `Framed-IP-Netmask` - IP netmask for user
- `Framed-IPv6-Prefix` - IPv6 prefix assignment
- `Session-Timeout` - Maximum session duration
- `Idle-Timeout` - Session timeout if idle
- `Class` - Operator-specific data for session
- `Filter-Id` - Policy filter to apply

> [!NOTE]
> SMC's handling of RADIUS authorisation attributes depends on configuration and deployment. Not all attributes affect session behaviour.

### Disable Authentication

To use RADIUS for accounting only without authentication:

```yaml
aaa:
  radius:
    enabled: true
    authenticate:
      enabled: false  # Disable RADIUS authentication
    start:
      enabled: true
    stop:
      enabled: true
    server:
      addr: "192.168.1.100"
      type: "ipv4"
      password: "sharedsecret"
      acct:
        port: 1813  # Accounting port
```

When authentication is disabled:
- Sessions are established without RADIUS Access-Request/Accept exchange
- Users are not validated against RADIUS server
- Only accounting records are sent (if enabled)

This is common when authentication is handled by another system (HSS, UDM) or not required.

## AAA Accounting Configuration

> [!NOTE]
> This section covers RADIUS accounting for **operational AAA** purposes (session tracking, security auditing). For RADIUS accounting used for **billing and charging**, see [RADIUS Charging](https://docs.cennso.com/components/smc/latest/guides/aaa/charging/radius.md).

RADIUS accounting tracks session lifecycle events for network operations:
- Session establishment and termination
- Session state changes
- Security auditing
- Network usage monitoring (non-billing)

Enable accounting phases:

```yaml
aaa:
  radius:
    enabled: true
    authenticate:
      enabled: true  # Often combined with authentication
    start:
      enabled: true   # Send Accounting-Start
    interim:
      enabled: true   # Send Accounting-Interim
    stop:
      enabled: true   # Send Accounting-Stop
    server:
      addr: "192.168.1.100"
      type: "ipv4"
      password: "sharedsecret"
      auth:
        port: 1812
      acct:
        port: 1813
```

### Accounting Phases

#### Accounting-Start

Sent when a user session is established. Contains session identification and initial state:

**Standard attributes:**
- `User-Name` - Subscriber identifier (typically IMSI)
- `Acct-Session-Id` - Unique session identifier
- `Acct-Status-Type` - Set to `Start` (1)
- `NAS-Identifier` - SMC node identifier
- `NAS-IP-Address` - SMC IP address
- `NAS-Port-Type` - Access technology (for example, `Virtual` for mobile)
- `Framed-IP-Address` - User's IPv4 address
- `Framed-IPv6-Prefix` - User's IPv6 prefix
- `Called-Station-Id` - APN or DNN name
- `Event-Timestamp` - Session start time

**3GPP-specific attributes:**
- `3GPP-IMSI` - International Mobile Subscriber Identity
- `3GPP-IMEI` - International Mobile Equipment Identity
- `3GPP-RAT-Type` - Radio Access Technology
- `3GPP-User-Location-Info` - Cell/tracking area location
- `3GPP-SGSN-Address` - Serving gateway address

Enable with `start.enabled: true`. Automatically sent when a GTP Create Session or PFCP Session Establishment completes successfully.

#### Accounting-Interim

Sent periodically during an active session. Contains cumulative session state:

**Additional attributes beyond Start:**
- `Acct-Status-Type` - Set to `Interim-Update` (3)
- `Acct-Session-Time` - Session duration in seconds
- `Acct-Input-Octets` - Downlink data volume
- `Acct-Output-Octets` - Uplink data volume
- `Acct-Input-Packets` - Downlink packet count
- `Acct-Output-Packets` - Uplink packet count

Interim interval controlled by `aaa.acctInterimInterval`:

```yaml
aaa:
  acctInterimInterval: 3600  # Send interim every 3600 seconds (1 hour)
  radius:
    interim:
      enabled: true
```

> [!CAUTION]
> If RADIUS interim or stop accounting are enabled, `aaa.acctInterimInterval` cannot be `null`.

**Common interim intervals:**
- `300` (5 minutes) - Frequent updates, higher server load
- `1800` (30 minutes) - Balanced
- `3600` (1 hour) - Infrequent updates, lower server load
- `null` - No interim records (only Start and Stop)

#### Accounting-Stop

Sent when a user session terminates. Contains final session state and termination reason:

**Additional attributes beyond Interim:**
- `Acct-Status-Type` - Set to `Stop` (2)
- `Acct-Terminate-Cause` - Reason for session termination
  - `User-Request` (1) - Normal termination by user
  - `Lost-Carrier` (2) - Connection lost
  - `Idle-Timeout` (4) - Session idle too long
  - `Session-Timeout` (5) - Maximum duration reached
  - `Admin-Reset` (6) - Administrative termination
  - `NAS-Request` (7) - Network-initiated termination

Enable with `stop.enabled: true`. Automatically sent when a GTP Delete Session or PFCP Session Deletion completes.

## Server Configuration

### Separate Authentication and Accounting Servers

Use different servers for authentication and accounting:

```yaml
aaa:
  radius:
    enabled: true
    authenticate:
      enabled: true
    server:
      acct:
        standalone: true
        addr: "192.168.1.200"
        port: 1813
        type: "ipv4"
        password: "acctsecret"
      auth:
        addr: "192.168.1.100"
        port: 1812
        type: "ipv4"
        password: "authsecret"
```

When `server.acct.standalone` is `true`:
- Authentication messages (Access-Request) → `server.auth`
- Accounting messages (Accounting-Request) → `server.acct`

This is useful when separate RADIUS servers handle authentication and accounting for administrative or security reasons.

### Address Types

RADIUS servers can be specified using different address types.

#### IPv4

```yaml
server:
  addr: "192.168.1.100"
  type: "ipv4"
```

Standard IPv4 dotted-decimal notation.

#### IPv6

```yaml
server:
  addr: "2001:db8::1"
  type: "ipv6"
```

Standard IPv6 colon-hexadecimal notation.

#### FQDN (Fully Qualified Domain Name)

```yaml
server:
  addr: "radius.example.com"
  type: "fqdn"
```

DNS resolution is performed at runtime. Useful for:
- Servers with dynamic IP addresses
- DNS-based failover
- Cloud deployments

> [!TIP]
> Use FQDN for production deployments to enable DNS-based load balancing and failover.

## Attribute Filtering

Filter specific RADIUS attributes from messages:

```yaml
aaa:
  radius:
    enabled: true
    avp_filters:
      - "Calling-Station-Id"
      - "Called-Station-Id"
      - "User-Password"
    server:
      addr: "192.168.1.100"
      type: "ipv4"
      password: "sharedsecret"
```

Attributes listed in `avp_filters` are excluded from **all** RADIUS messages (Access-Request, Accounting-Request).

**Common attributes to filter:**
- `User-Password` - Never send passwords in accounting (should never be present anyway)
- `Calling-Station-Id` - Originating number (privacy concern)
- `Called-Station-Id` - Destination number (privacy concern)
- `NAS-IP-Address` - Network Access Server address (security concern)
- `Framed-IP-Address` - User's IP address (privacy concern)

> [!IMPORTANT]
> Filtering affects both authentication and accounting messages. Do not filter attributes required by your RADIUS server for authentication or accounting.

## Transport Protocol

RADIUS uses UDP (User Datagram Protocol) as its transport. UDP is lightweight but does not guarantee delivery.

SMC implements RADIUS reliability through:
- **Retransmission** - Unanswered requests are retransmitted
- **Timeout detection** - Requests that don't receive responses within a timeout are retried
- **Duplicate detection** - Responses are matched to requests using Request Authenticator
- **Request queueing** - Requests are queued if the server is temporarily unreachable

> [!NOTE]
> Unlike Diameter, RADIUS does not support TCP or SCTP. All RADIUS communication is over UDP.

**UDP characteristics relevant to RADIUS:**
- No connection establishment overhead (faster than TCP)
- No delivery guarantee (relies on retransmission)
- No flow control (can overwhelm servers)
- Suitable for request-response patterns

**Performance considerations:**
- RADIUS is efficient for authentication (one request-response per session)
- For accounting, UDP may lose messages during network congestion
- Consider Diameter (Rf, NASREQ) for mission-critical accounting

## Example Configurations

### Authentication Only

RADIUS authentication without accounting:

```yaml
aaa:
  radius:
    enabled: true
    authenticate:
      enabled: true
    start:
      enabled: false
    interim:
      enabled: false
    stop:
      enabled: false
    server:
      addr: "auth.example.com"
      type: "fqdn"
      password: "AuthSecret123"
      auth:
        port: 1812
```

Use case: Authentication is required, but accounting is handled by Diameter Rf or another system.

### Authentication + AAA Accounting

Full AAA with authentication and accounting:

```yaml
aaa:
  acctInterimInterval: 1800  # 30-minute interim updates
  
  radius:
    enabled: true
    authenticate:
      enabled: true
    start:
      enabled: true
    interim:
      enabled: true
    stop:
      enabled: true
    server:
      addr: "aaa.example.com"
      type: "fqdn"
      password: "SharedSecret456"
      auth:
        port: 1812
      acct:
        port: 1813
```

Use case: Single RADIUS server handles both authentication and operational accounting.

### Separate Auth and Acct Servers

Different servers for authentication and accounting:

```yaml
aaa:
  acctInterimInterval: 3600  # 1-hour interim updates
  
  radius:
    enabled: true
    authenticate:
      enabled: true
    start:
      enabled: true
    interim:
      enabled: true
    stop:
      enabled: true
    server:
      acct:
        standalone: true
        addr: "acct.example.com"
        port: 1813
        type: "fqdn"
        password: "AcctSecret789"
      auth:
        addr: "auth.example.com"
        port: 1812
        type: "fqdn"
        password: "AuthSecret123"
```

Use case: Separate servers for security, scale, or administrative boundaries.

### Accounting Only (No Authentication)

AAA accounting without authentication:

```yaml
aaa:
  acctInterimInterval: 3600
  
  radius:
    enabled: true
    authenticate:
      enabled: false  # No authentication
    start:
      enabled: true
    interim:
      enabled: true
    stop:
      enabled: true
    server:
      addr: "acct.example.com"
      type: "fqdn"
      password: "AcctSecret"
      acct:
        port: 1813
```

Use case: Authentication is handled by another system (HSS, UDM), but RADIUS accounting needed for operations.

### Start and Stop Only (No Interim)

Minimal accounting with start and stop only:

```yaml
aaa:
  acctInterimInterval: null  # No interim records
  
  radius:
    enabled: true
    authenticate:
      enabled: true
    start:
      enabled: true
    interim:
      enabled: false  # No interim
    stop:
      enabled: true
    server:
      addr: "192.168.1.100"
      type: "ipv4"
      password: "MinimalAcct"
      auth:
        port: 1812
      acct:
        port: 1813
```

Use case: Only track session start and stop for security auditing, not interested in interim state.

### With Attribute Filtering

Privacy-focused configuration with attribute filtering:

```yaml
aaa:
  acctInterimInterval: 3600
  
  radius:
    enabled: true
    authenticate:
      enabled: true
    start:
      enabled: true
    interim:
      enabled: true
    stop:
      enabled: true
    avp_filters:
      - "Calling-Station-Id"
      - "Called-Station-Id"
      - "NAS-IP-Address"
    server:
      addr: "privacy-radius.example.com"
      type: "fqdn"
      password: "PrivacySecret"
      auth:
        port: 1812
      acct:
        port: 1813
```

Use case: Filter privacy-sensitive attributes for GDPR or regulatory compliance.

### IPv6 Dual-Stack

RADIUS server on IPv6 network:

```yaml
aaa:
  radius:
    enabled: true
    authenticate:
      enabled: true
    start:
      enabled: true
    stop:
      enabled: true
    server:
      addr: "2001:db8:aaa::1"
      type: "ipv6"
      password: "IPv6Secret"
      auth:
        port: 1812
```

Use case: IPv6-only or dual-stack deployment.

## AAA vs Charging

RADIUS can serve both AAA and charging in SMC. Understanding the distinction is crucial:

### RADIUS for AAA (This Document)

**Purpose:** Identity verification and operational session tracking

**Configuration location:** `aaa.radius.*`

**Triggered by:** Session establishment procedures

**Sent regardless of:** PCC rules, rating groups, or charging configuration

**Use cases:**
- Authenticate subscribers before allowing network access
- Track session establishment for security monitoring
- Audit network usage for operations (not billing)
- Collect session data for troubleshooting

**Example:** Network operator wants to know "who connected, when, and for how long" for security purposes.

### RADIUS for Charging (See [RADIUS Charging](https://docs.cennso.com/components/smc/latest/guides/aaa/charging/radius.md))

**Purpose:** Billing data collection and revenue assurance

**Configuration location:** Same `aaa.radius.*` but conceptually different concern

**Triggered by:** PCC rules with `offlineEnabled: true`

**Sent based on:** Rating groups and charging configuration

**Use cases:**
- Generate usage records for billing systems
- Collect data volume per rating group
- Integrate with offline charging systems (OFCS)
- Generate Call Detail Records (CDRs)

**Example:** Billing system needs to know "how much data was used" to bill the subscriber.

### Practical Configuration

In practice, the same RADIUS accounting configuration often serves both purposes:

```yaml
aaa:
  # Accounting serves both AAA and charging
  acctInterimInterval: 1800
  
  radius:
    enabled: true
    authenticate:
      enabled: true  # AAA: Authentication
    start:
      enabled: true  # AAA + Charging: Session start
    interim:
      enabled: true  # AAA + Charging: Periodic updates
    stop:
      enabled: true  # AAA + Charging: Session end
    server:
      addr: "radius.example.com"
      type: "fqdn"
      password: "Secret"
      auth:
        port: 1812
      acct:
        port: 1813
```

The RADIUS server receiving these messages may:
- Store them for AAA purposes (security, operations)
- Forward them to billing systems for charging
- Do both

This is why the helm chart mixes these concerns under `aaa.*` - they share the same infrastructure.

## RADIUS vs Diameter NASREQ

Both RADIUS and Diameter NASREQ are "true AAA" protocols. When to use which?

| Feature | RADIUS | Diameter NASREQ |
|---|:---:|:---:|
| Transport | UDP | TCP or SCTP |
| Reliability | Best-effort | Connection-oriented |
| Message size | Limited (~4KB) | Unlimited |
| Roaming support | Proxy chains | Direct routing |
| Extensibility | Limited | Extensive AVPs |
| 3GPP native | No | Yes |
| Deployment complexity | Simple | Complex |
| Legacy support | Excellent | Limited |

**Choose RADIUS when:**
- Integrating with existing RADIUS infrastructure
- Simple deployments without complex roaming
- Legacy systems require RADIUS
- Lower deployment complexity preferred

**Choose Diameter NASREQ when:**
- Building modern 3GPP-compliant systems
- Complex roaming arrangements
- Need for rich attribute support
- TCP/SCTP reliability required

See [Diameter NASREQ](https://docs.cennso.com/components/smc/latest/guides/aaa/authentication/nasreq.md) for Diameter-based AAA configuration.

## Troubleshooting

### Authentication Failures

**Symptom:** Sessions are rejected, users cannot connect.

**Possible causes:**
- RADIUS server is down or unreachable
- Incorrect shared secret (`server.password`)
- RADIUS server rejecting users (Access-Reject)
- Network connectivity issues

**Solution:**

1. Check RADIUS server connectivity:
   ```bash
   ping {RADIUS_SERVER}
   ```

2. Verify port is open:
   ```bash
   nc -u -v {RADIUS_SERVER} 1812
   ```

3. Check SMC logs for RADIUS errors:
   ```bash
   kubectl logs {POD_NAME} | grep -i radius
   ```

4. Verify shared secret matches between SMC and RADIUS server

5. Check RADIUS server logs for Access-Reject reasons

### Accounting Messages Not Received

**Symptom:** RADIUS server not receiving accounting messages.

**Possible causes:**
- Accounting not enabled (`start/interim/stop.enabled: false`)
- RADIUS server unreachable
- UDP packets dropped by firewall
- Incorrect accounting port (should be 1813)

**Solution:**

1. Verify accounting is enabled:
   ```yaml
   start:
     enabled: true
   stop:
     enabled: true
   ```

2. Check server address and port:
   ```yaml
   server:
     addr: "{CORRECT_ADDRESS}"
     port: 1813  # Standard accounting port
   ```

3. Test UDP connectivity:
   ```bash
   nc -u -v {RADIUS_SERVER} 1813
   ```

4. Check firewall rules for UDP port 1813

5. Review SMC logs for accounting errors

### Interim Interval Errors

**Symptom:** Error about `acctInterimInterval` being null.

**Cause:** Interim or stop accounting enabled without setting interim interval.

**Solution:**

Set `acctInterimInterval`:

```yaml
aaa:
  acctInterimInterval: 3600  # Cannot be null
```

Or disable interim accounting:

```yaml
radius:
  interim:
    enabled: false
interim:
      enabled: true  # This requires acctInterimInterval
```

### High RADIUS Server Load

**Symptom:** RADIUS server overloaded, slow responses.

**Possible causes:**
- Interim interval too short
- Too many sessions
- Server underpowered

**Solution:**

1. Increase interim interval:
   ```yaml
   acctInterimInterval: 3600  # Increase from 1800
   ```

2. Disable interim accounting if not needed:
   ```yaml
   interim:
     enabled: false
   ```

3. Scale RADIUS server (more CPU, memory)

4. Consider switching to Diameter for better load distribution

## Related Documentation

- [AAA Overview](https://docs.cennso.com/components/smc/latest/guides/aaa/overview.md) - Understanding the three concerns
- [Diameter NASREQ](https://docs.cennso.com/components/smc/latest/guides/aaa/authentication/nasreq.md) - Diameter-based AAA
- [RADIUS Charging](https://docs.cennso.com/components/smc/latest/guides/aaa/charging/radius.md) - RADIUS for billing
- [Diameter Concepts](https://docs.cennso.com/components/smc/latest/guides/aaa/diameter-concepts.md) - Generic Diameter transport
