Site icon System Zone

FreeRADIUS User Profile Configuration for MikroTik Router

FreeRADIUS is a high performance RADIUS application that accepts a large number of network devices as RADIUS Client including MikroTik Router. FreeRADIUS MySQL module helps to get user authentication and authorization information from database server and to store user accounting information in database server. Configuring MySQL user group and profile properly, freeRADIUS user restriction can easily be maintained. How to configure user group to apply user limitation was discussed in my previous article. In this article, I will discuss how to configure freeRADIUS user profile to apply user limitation with more efficiently.

FreeRADIUS User Profile Configuration

FreeRADIUS User Profile Configuration

A user profile is nothing but a user who has no entry in radcheck and radreply table but is a member of one or more groups to hold reply attributes. Assigning group to a profile is done with radusergroup table. User-Profile internal AVP is used to assign a profile to a user with radcheck table. So, a complete profile configuration is done by the following steps.

In this article, we will create the following three profiles for MikroTik PPPoE users according to the above steps.

Profile NameProperties
512k_ProfileBandwidth 512kbps and IP Pool will be 512k_pool
1M_ProfileBandwidth 1Mbps and IP Pool will be 1M_pool
2M_ProfileBandwidth 2Mbps and IP Pool will be 2M_pool

Creating User Limitation with Group Management

In freeRADIUS, group is used to categorize user check and reply attributes that actually apply user limitations. The radgroupcheck table contains check AVPs and the radgroupreply table contains reply AVPs. As we will create three user profiles, we have to create three groups also. Our proposed groups name and its check and reply attributes are summarized with the following tables.

Group NameCheck AVPsReply AVPs
512kFramed-Protocol to check PPPMikroTik-Rate-Limit to apply 512kbps bandwidth and Framed-Pool to assign IP to the requested client.
1MFramed-Protocol to check PPPMikroTik-Rate-Limit to apply 1Mbps bandwidth and Framed-Pool to assign IP to the requested client.
2MFramed-Protocol to check PPPMikroTik-Rate-Limit to apply 2Mbps bandwidth and Framed-Pool to assign IP to the requested client.

The radgroupcheck table contains group check AVPs. So, we have to insert group check AVP Framed-Protocol in radgroupcheck table. The following steps will show how to insert check AVP in the radgroupcheck table.

These entries ensure that group reply only applicable for the PPP request. After inserting group checking, we will now insert group reply AVP in the radgroupreply table. The following steps will show how to insert reply AVPs in the radgroupreply table.

Group reply attributes are inserted successfully. Now we will assign our desired user profile to group.

Assigning Group to a Profile Holder User

After creating groups, it is time to assign group to user. As discussed early, freeRADIUS profile is a user but it has no entry in radcheck and radreply table. So, our proposed three profiles (512k_Profile, 1M_Profile and 2M_Profile) are logical users and we will assign these users to group according to the following table.

Profile NameGroup Name
512k_Profile512k
1M_Profile1M
2M_Profile2M

The radusergroup table contains user to group mapping. So, we need to insert entry in radusergroup table to map our profile and group. The following steps will show how to map profile and group in radusergroup table.

Profile to group mapping has been completed. Now we will create user and assign profile to user.

Assigning Created Profile to Users

After creating user profile, we can create as many users as we want and assign their profile with User-Profile control attribute for applying user limitation. The radcheck table contains user check attribute. So, to create users, we have to insert username and password as well as other user check attribute in radcheck table. In this article, we will create three users (bob, alice and tom) and assign their profile with radcheck table. The following steps will show how to insert user check attribute in radcheck table.

We have successfully created three RADIUS users and assigned their profile. Now we will check these users login and reply attributes with radtest program.

FreeRADIUS User Profile Testing with radtest Program

We will now test our user profile configuration with radtest program. So, issue the following command to login with bob user and check his reply attribute.

[root@freeradius ~]# radtest bob passme 127.0.0.1 100 testing123 1

Sent Access-Request Id 14 from 0.0.0.0:41714 to 127.0.0.1:1812 length 79

User-Name = “bob”

User-Password = “passme”

NAS-IP-Address = 192.168.40.10

NAS-Port = 100

Message-Authenticator = 0x00

Framed-Protocol = PPP

Cleartext-Password = “passme”

Received Access-Accept Id 14 from 127.0.0.1:1812 to 0.0.0.0:0 length 152

Framed-Protocol = PPP

Framed-Compression = Van-Jacobson-TCP-IP

Framed-Pool = “512k_pool”

Mikrotik-Rate-Limit = “512k/512k 1M/1M 512k/512k 40/40”

If everything is OK, the radtest program will show the abobe output. That means, bob user will now be able to login to freeRADIUS client devices with his password and after successful login he will get an IP from 512k_pool and his bandwidth will be according to Mikrotik-Rate-Limit AVP.

Similarly, you can test alice and tom user with radtest program and can check user reply attributes. In the next article, we will test freeRADIUS user profile from a MikroTik Router where MikroTik PPPoE Service will be accessible with these users.

If you face any confusion to follow above steps properly, watch the below video about MikroTik with FreeRADIUS User Profile Configuration. I hope it will reduce your any confusion.

How to configure freeRADIUS user profile with MySQL database has been discussed in this article. I hope you will now be able to configure freeRADIUS user profile according to your organization requirements. However, if you face any confusion, feel free to discuss in comment or contact with me from Contact page. In the next article, I will show how to configure MikroTik PPPoE Service with freeRADIUS Server and authenticate and authorize PPPoE users from these profile users.

Exit mobile version