Mikrotik NAS is authenticating but not recording data in radacct table
You're experiencing an issue where Mikrotik NAS is successfully authenticating users but the accounting data is not being recorded in the FreeRADIUS radacct
table in MySQL.
This guide will help you troubleshoot and resolve this issue step by step.
Verify that your Mikrotik is properly configured to send accounting data to FreeRADIUS:
Check if the SQL module is properly configured and enabled:
Ensure accounting is enabled in FreeRADIUS sites:
Ensure your Mikrotik is configured to send both authentication and accounting requests to FreeRADIUS:
Check your /etc/freeradius/3.0/mods-enabled/sql file:
Check your /etc/freeradius/3.0/sites-enabled/default file and ensure the accounting section includes sql:
Note: After making any configuration changes, remember to restart FreeRADIUS:
Run FreeRADIUS in debug mode to see what's happening with accounting requests:
Now generate some accounting data from your Mikrotik and watch the debug output for any SQL-related errors.
Success indicators: Look for messages like "Processing accounting packets" and "SQL query executed successfully" in the debug output.
Error indicators: If you see "SQL module not active" or database connection errors, your SQL configuration needs attention.
Ensure the radius user has proper permissions on the radacct table:
If the SQL module isn't enabled in the accounting section, data won't be saved to the database.
Solution: Edit /etc/freeradius/3.0/sites-enabled/default and ensure the accounting section includes this line:
If FreeRADIUS can't connect to the MySQL database, accounting data won't be saved.
Solution: Verify your database connection settings in /etc/freeradius/3.0/mods-enabled/sql
If the SQL queries in the FreeRADIUS configuration don't match your database schema, updates will fail.
Solution: Check the accounting queries in /etc/freeradius/3.0/mods-config/sql/main/mysql/queries.conf
The accounting port (1813) might be blocked by a firewall.
Solution: Ensure port 1813 is open on your FreeRADIUS server: