FreeRadius2 + MySQL + Data Cap
I am trying to setup a hotspot where all users get a free daily download quota (50mb).
I am going to use the cp to add the users MAC to mysql via php and authenticate from there, however i am able to get the quota working!
The quota works when not using mysql so there must be something i need to do in mysql.
can anyone even give me a hint? PLEAAASSSSE
michel2013 last edited by
I guess we need some more information about your setup and config.
What is your current quota setup?
Nachtfalke last edited by
you need to do accounting on mysql. Never used this myself but this could help you on starting work:
I finally got this sorted, and to help anyone else out here is what worked for me (i am writing this from home mostly from memory, but you will get the idea), most of what i have done is based on this link http://forum.pfsense.org/index.php/topic,57260.msg305604.html#msg305604
Get the basic captive portal and freeradius setup and make sure it works with local users.
Install php-mysql support as detailed at the above link
Edit the file /usr/local/etc/raddb/sql/mysql/counter.conf and replace with the contents of the one attached to this post.
Edit /usr/local/pkg/freeradius.inc and add the counters from the counter.conf (DailyDataCounter, MonthlyDataCounter & NoResetCounter) to the "Instantiation" section of raddb.conf and sites-enabled default.conf. I removed the references to the other time based counters i.e. daily, weekly & monthly. This file needs to be modified otherwise any changes to the raddb.conf file will reset on a reboot
Modify the default captive portal and error page with the one attached to this post and add the other attachents through captive file manager.
Enable sql otherwise it will not be used
Run the sql in the attached "SQL-Groups.txt" to create groups to assign amount of traffic.
make sure the captive portal is set to auto authenticate every minute.
In theory any one who connects through the captive portal will be asked to register, and they will by default have 30mb of daily download.
This may not be the best way but and if anyone wants to correct me go for it as i just want to learn.