Navigation

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

    FreeRadius2 + MySQL + Data Cap

    Captive Portal
    3
    5
    4677
    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

      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

        can anyone even give me a hint? PLEAAASSSSE

        1 Reply Last reply Reply Quote 0
        • M
          michel2013 last edited by

          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

            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

              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