Part 1 - Mikrotik Hotspot & Freeradius -- Create your own user manager

FreeRADIUS is a free open source RADIUS server.

It offers an alternative to other enterprise RADIUS servers, as it is one of the most modular and feature-rich RADIUS servers available today. It is also within the top 5 RADIUS servers world-wide in terms of number of deployments, and number of users who are authenticated with it every day (Source : Wikipedia).

Below are simple steps to creating your own user manager based on Freeradius + MySQL for Mikrotik Hotspot and assume that we are already Install the Freeradius with MySQL support, but if you not install it already then read here for the Freeradius install instruction (I will write for it in another time). Let's do it in my way (Sorry, i write this post in several part).

In this way we are using Freeradius as an authentication server and using MySQL to store user database. Looks like we are gonna use web as an interface!. Not really, this time we just need to know what tables are used for user managing and we can use any MySQL administrator software for it (i.e. phpMyAdmin).


Above are list of tables in freeradius database (Admin and PrintUser tables are optional -- create by me), some tables aren't needed at this time, tables we are needed is: radcheck, radgroupreply and usergroup.

racheck are used for storing user information like user name and password
radgroupreply are used for reply to the radius client some of user group information (i.e. Rate limit, iddle time and etc) in this case Mikrotik Hotspot is act as a Radius client .
usergroup are used for storing user grouping information.

RADCHECK
Field : id, UserName, Attribute, op, Value

See this picture for example implementation.

UserName are filled with user log in name information.
Attribute are filled with user attribute information.
op are filled with operational key for attribute value.
Value are filled with attibute values like user password or number of session time.

In the Attribute field:
User-Password - giving UserName with a password in the related Value field. Max-All-Session - giving user a maximum session time in the related Value field.

Next usergroup and radgroupreply.