Radius status-ttl
Radius status-ttl
FortiOS 7.4.0 起支持 RADIUS Server 可达性状态缓存(status-ttl)。当 Radius 配置了备用服务器或第三服务器时,FortiGate 可以在缓存有效期内跳过连续无响应的服务器,直接尝试状态可用的备用服务器,从而减少用户认证延迟。
功能介绍
在 FortiOS 7.4.0 之前,即使主 Radius Server 已经不可达,FortiGate 仍会先尝试主服务器;如果主服务器一直超时,用户认证可能出现明显延迟,部分场景下甚至会导致认证失败。
FortiGate 检测到某个 Radius Server 连续 5 次无响应后,会将该服务器标记为不可达。默认配置 set status-ttl 300 表示可达性状态缓存 300 秒,在缓存过期前 FortiGate 不会继续向该不可达服务器发送认证请求。
Radius Server 可达性状态包含以下 3 种:
| 状态码 | 状态名称 | 说明 |
|---|---|---|
-1 | Undetermined | 在 status-ttl 周期内尚未向该服务器发送认证请求,状态未确定。该服务器仍可以接收认证请求。 |
0 | Unreachable | 该服务器连续 5 次无响应,在 status-ttl 超时前不会继续向该服务器发送认证请求。 |
1 | Reachable | 该服务器在 status-ttl 周期内至少响应过 1 次,FortiGate 可以继续向该服务器发送认证请求。 |
配置方法
在 Radius 配置中设置主 Radius Server、备用 Radius Server、第三 Radius Server 和可达性状态缓存时间。
config user radius edit "RADIUS-FAC" set server "192.0.2.10" set secret fortinet set auth-type pap set secondary-server "192.0.2.20" set secondary-secret fortinet set tertiary-server "192.0.2.30" set tertiary-secret fortinet set timeout 5 set status-ttl 300 next end参数说明
set timeout 5:单次连接超时时间为 5 秒,超时后 FortiGate 会尝试下一个可用服务器。set status-ttl 300:Radius Server 可达性状态缓存 300 秒。
查看方式
执行 diagnose test application fnbamd 6 查看每个 Radius Server 的可达性状态,在输出中确认目标 Radius Server 的 reachable 字段。
# diagnose test application fnbamd 6
...
RADIUS servers: (7)
...
RADIUS-FAC (ref=1)
Flags: 0028
Network Protocol: UDP
Timeout: 5
Server '192.0.2.10', port 1812, reachable: 0 (131 secs ago), cur fails: 5/5
# 131秒前,该服务器已被标记为无法访问(5 次尝试失败),在达到 status-ttl 之前,它不会被使用。
Server '192.0.2.20', port 1812, reachable: 1 (119 secs ago), cur fails: 0/5
# 服务器可达,最后一次响应是在119秒前。
Server '192.0.2.30', port 1812, reachable: -1 (0 secs ago), cur fails: 3/5
# cur fails: 1/5 标识已经有 3 次探测失败,服务器状态为未知,FGT 仍会发送认证请求到该服务器。
...Debug 观察
开启
fnbamddebug 后发起一次 Radius 认证,观察 Radius Server 连接超时以及失败计数变化。主服务器超时示例:# diagnose debug application fnbamd -1 # diagnose debug enable # 正在与主服务器 192.0.2.10 建立连接 2023-07-28 10:12:40 [566] fnbamd_rad_make_access_request- 2023-07-28 10:12:40 [329] __create_access_request-Compose RADIUS request 2023-07-28 10:12:40 [549] __create_access_request-Created RADIUS Access-Request. Len: 100. 2023-07-28 10:12:40 [758] __rad_rxtx-Sent radius req to server 'RADIUS-FAC': fd=11, IP=192.0.2.10(192.0.2.10:1812) code=1 id=115 len=100 2023-07-28 10:12:40 [767] __rad_rxtx-Start rad conn timer. # 服务器在配置的 5 秒超时时间内未作出响应 2023-07-28 10:12:45 [639] __rad_conn_timeout-Connction with RADIUS-FAC:192.0.2.10 timed out. 2023-07-28 10:12:45 [907] __rad_error-Ret 10, st = 1. 2023-07-28 10:12:45 [296] fnbamd_radius_get_next_auth_prot-Next auth prot PAP 2023-07-28 10:12:45 [930] __rad_error-Conn failed. 2023-07-28 10:12:45 [985] fnbamd_cfg_radius_update_reachability-192.0.2.10, conn_fails 4/5 2023-07-28 10:12:45 [725] __rad_rxtx-fd 11, state 1(Auth) 2023-07-28 10:12:45 [727] __rad_rxtx-Stop rad conn timer.观察完成后关闭并重置 debug。
diagnose debug disable diagnose debug reset
日志记录
Radius Server 可达性状态变化会记录到用户事件日志中,日志 ID 为 0102043056,日志描述为 Auth server reachability update。
从
Undetermined变为Unreachable:date=2024-12-21 time=18:53:29 eventtime=1734764008947419454 tz="+1200" logid="0102043056" type="event" subtype="user" level="notice" vd="vdom1" logdesc="Auth server reachability update" msg="RADIUS server: 192.0.2.10, port 1812, reachability changing from Undetermined to Unreachable"从
Undetermined变为Reachable:date=2024-12-21 time=18:51:21 eventtime=1734763880976445800 tz="+1200" logid="0102043056" type="event" subtype="user" level="notice" vd="vdom1" logdesc="Auth server reachability update" msg="RADIUS server: 192.0.2.10, port 1812, reachability changing from Undetermined to Reachable"