使用radiusd -X 启动 可以看到启动过程及出错原因
配合查看日志/var/log/radius/radius.log 可以解决大部分内容
但radiusd -X可以启动 使用systemctl start radiusd.service启动却报错
代码语言:javascript复制[root@101-103 system]# systemctl start radiusd.service
Job for radiusd.service failed because the control process exited with error code. See "systemctl status radiusd.service" and "journalctl -xe" for details.
[root@101-103 system]# systemctl status radiusd.service
● radiusd.service - FreeRADIUS high performance RADIUS server.
Loaded: loaded (/usr/lib/systemd/system/radiusd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 2020-11-19 15:26:38 CST; 8s ago
Process: 4505 ExecStart=/usr/sbin/radiusd -d /etc/raddb (code=exited, status=1/FAILURE)
Process: 4500 ExecStartPre=/usr/sbin/radiusd -C (code=exited, status=0/SUCCESS)
Process: 4498 ExecStartPre=/bin/chown -R radiusd.radiusd /var/run/radiusd (code=exited, status=0/SUCCESS)
日志内容:
代码语言:javascript复制Thu Nov 19 15:19:16 2020 : Info: rlm_sql_mysql: libmysql version: 5.5.60-MariaDB
Thu Nov 19 15:19:16 2020 : Info: rlm_sql (sql): Attempting to connect to database "radiusdb"
Thu Nov 19 15:19:16 2020 : Info: rlm_sql (sql): Opening additional connection (0), 1 of 32 pending slots used
Thu Nov 19 15:19:16 2020 : Error: rlm_sql_mysql: Couldn't connect to MySQL server dbuser@localhost:radiusdb
Thu Nov 19 15:19:16 2020 : Error: rlm_sql_mysql: MySQL error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
Thu Nov 19 15:19:16 2020 : Error: rlm_sql (sql): Opening connection failed (0)
Thu Nov 19 15:19:16 2020 : Error: /etc/raddb/mods-enabled/sql[20]: Instantiation failed for module "sql"
可以看到是找不到sock 我把sock创建了软链依旧不行
看到篇文章说 localhost 会走域套接字 使用IP地址却不会 于是改下配置文件:
代码语言:javascript复制vim /etc/raddb/mods-available/sql
把localhost改为127.0.0.1 成功
代码语言:javascript复制 # The dialect of SQL you want to use, this should usually match
# the driver you selected above.
#
# If you're using rlm_sql_null, then it should be the type of
# database the logged queries are going to be executed against.
dialect = "mysql"
# Connection info:
#
server = "127.0.0.1"