• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

FreeRadius2 + MySQL + Data Cap

Scheduled Pinned Locked Moved Captive Portal
5 Posts 3 Posters 4.9k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V
    V0BVSUQR700KJ67T
    last edited by May 30, 2013, 12:04 PM

    Hi all

    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.

    Any ideas?

    Lloyd

    1 Reply Last reply Reply Quote 0
    • V
      V0BVSUQR700KJ67T
      last edited by Jun 3, 2013, 2:36 PM

      can anyone even give me a hint? PLEAAASSSSE

      1 Reply Last reply Reply Quote 0
      • M
        michel2013
        last edited by Jul 12, 2013, 2:21 PM

        I guess we need some more information about your setup and config.

        What is your current quota setup?

        1 Reply Last reply Reply Quote 0
        • N
          Nachtfalke
          last edited by Jul 12, 2013, 7:35 PM

          you need to do accounting on mysql. Never used this myself but this could help you on starting work:
          http://wiki.freeradius.org/modules/Rlm_sqlcounter
          http://lists.freeradius.org/pipermail/freeradius-users/2012-February/058923.html

          1 Reply Last reply Reply Quote 0
          • V
            V0BVSUQR700KJ67T
            last edited by Jul 31, 2013, 8:43 PM

            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

            1. Get the basic captive portal and freeradius setup and make sure it works with local users.

            2. Install php-mysql support as detailed at the above link

            3. Edit the file /usr/local/etc/raddb/sql/mysql/counter.conf and replace with the contents of the one attached to this post.

            4. 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

            5. Modify the default captive portal and error page with the one attached to this post and add the other attachents through captive file manager.

            6. Enable sql otherwise it will not be used

            7. Run the sql in the attached "SQL-Groups.txt" to create groups to assign amount of traffic.

            8. 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.

            (captiveportal-cp.css).txt
            (captiveportal-error.htm).txt
            (captiveportal-initial.php).txt
            (captiveportal-register.php).txt
            (counter.conf).txt
            (SQL-Setup.sql).txt

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              [[user:consent.lead]]
              [[user:consent.not_received]]