Menu

how to get Permanent users to reset at fixed time daily

Help
Jimbob21
2013-11-24
2013-12-08
  • Jimbob21

    Jimbob21 - 2013-11-24

    Hi Dirk,
    Thanks for a fantastic program, I have installed on Ubuntu with nginx and all works well.
    I need help setting up a profile for a permanent user that reset at 10am daily for use with a hotel hotspot. This is to accomadate for the guest having to book out by 10am.
    I can get the profile to reset at midnight but can't seem to get it to work with set time.

    My profile allows for 50meg data with 3 connections for guests to use for free, if more data is needed the guest will need to purchase it.

    The username and password for the permanent user is displayed in each room. (126 permanent user created 1 per room)

    Help please.

    Jimmy.

     
  • Dirk van der Walt

    Hi Jimmy,

    Try and edit the following part in the file: /usr/local/etc/raddb/reset_time_for_data.pl

        sub start_of_day {
            #Get the current timestamp;
            my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
            #create a new timestamp:
            my $unixtime = mktime (0, 0, 0, $mday, $mon, $year, 0, 0);
            return $unixtime;
        }
    

    Change it to

         my $unixtime = mktime (0, 0, 10, $mday, $mon, $year, 0, 0);
    

    Let us know if this does the trick :-)

    • How to you go about with the extra data? Do the guests buy vouchers once their daily cap is depleted?

    • How do limit the connections to 3 concurrent ones? Does it work? The reason why I asl is that the checkrad script that comes with FreeRADIUS needs a small twek for the simultaneous connection check to work, which I still need to document and add to the documentation.... Hopefully before tomorrow ....

    Kind regards

     
  • Jimbob21

    Jimbob21 - 2013-11-25

    Hi Dirk,

    Thanks for the quick response, I made the change above and it seems to work (I changed the computer time to test.) I just checked and it reset at midnight, any other ideas?

    . The guests have to buy 250meg or 500 meg vouchers once the free data is depleted.

    . Tested the concurrent connections tonight and you were right it does not work, The limit I had set to allow only 3 connections worked but each connection used 50 megs before being disconnected. I would like the disconnection to occur when the joint total reaches 50 megs.

    Just abit of info about my installation it is running on an old HP laptop with a USB lan for eth1 which is connected to 3 PicoStations still running airos. (1 Pico is wired the other 2 are wireless, had the Pico's running as open AP but we found there was complete misuse.) Ran YFi for a short period untill I found Radiusdesk, Busy with second setup for a small Golf Estate in the George area.

    Cheers jimmy

     

    Last edit: Jimbob21 2013-11-25
  • Dirk van der Walt

    Hi Jimmy,

    You can check how to do the simultaneous session fix on this post:

    https://sourceforge.net/p/radiusdesk/discussion/help/thread/32ecd6e4

    Then as a side note on the three connections happening all at the same time. You will experience the 50megs on each connection when all three devices connect within a short time span from each other. The reason for this is as follows:

    • When the first device connects it will only report the usage at a interval specified by the value of the reply attribute Acct-Interim-Interval (under Misc).
    • When this is not specified Coova takes a default of 360 seconds (5 minutes).
    • The smallest value it accepts is 60 seconds.
    • So by adding this reply attribute it allows for a more responsive system.
    • Going back to three devices connecting. The first one connects and start reporting after say on minute that it used 20megs.
    • The second one connecting after the first report should then only have 30megs available.
    • On top of that if you only allow 3 devices connecting at the same time the back-end will inform the 4th device that the maximum sessions has been reached.

    To summarise then:

    • Add a Acct-Interim-Interval reply attribute with value of 60 to the profile.
    • Add a check attribute of Simultaneous-Use with value of 3 to the profile.
    • Test by connecting with the second device as soon as there is some data usage reported by the first device to confirm that the 50meg cap is distributed across the various devices.

    It's good news to learn RD is also used in South Africa! All the best with the new deployment. You may look into the possibility to run a central VPS and simply point the APs from the various localities to this central server.

    I'm running such a small deployment to a VPS somewhere in the USA and it is very stable. The only time we have trouble is when the Internet connection of the locality itself is failing which is usually a Telkom/ISP problem.

    I'm also working right now on including a mesh component with the RD. This will help to do quick and robust deployments at places like estates, security complexes as well as blocks of flats or even holiday resorts. Incidentally my development units are also PicoStations :-)

    Let me know if you may be interested to join in as a beta tester on the mesh stuff.

    Kind regards

     
  • Jimbob21

    Jimbob21 - 2013-11-26

    Hi Dirk,

    First of all the change made yesterday for the reset time of 10:00am did not work, still resets at midnight. What else can I look at?

    I replaced the checkrad and restarted the machine.

    I then connected the first laptop waited till usage showed of about 12 meg, then connected the second laptop.

    I watched the Activity Monitor and it showed the usage increase, when the joint total was about 51 megs I checked the user with Radius client which replyed "maximum daily usage exceeded".

    I then kept refreshing the Activity monitor and found the the data usage for both laptops kept climbing to the following totals Laptop 1 = 49.1meg and Laptop 2 = 47.3 meg before both were disconnected.

    I did this 3 times with differant users but the result was the same, all the totals were above 47 megs before they were disconnected.

    I also changed the 3 connections to 2 so I could check to see if the limit of the amount of users worked, the 3 rd connection was refused.

    My plan was to try a central PS but running it at my premises. I was going to try it as I have 5 static ip's which are not being used at this stage, I also run my whole setup on solar power with 2 independent ISP suppliers for fail-over only 1 has static IP's.

    I have played abit with mesh stuff and would enjoy beta testing it with Radiusdesk.

    I just need to get this Hotel to work the way owner wants it to work.

    Thanks for the help so far.

    Jimmy

     
  • Dirk van der Walt

    Hi Jimmy,

    Reading from your post I take the following:

    • You are now able to limit the number of simultaneous connected devices.
    • You are not able to get two devices to share the same data cap.

    I've just set up my VM and added a profile component with the following values:

    Attribute Check /Reply
    Rd-Total-Data check
    Rd-Reset-Type-Data check
    Rd-Cap-Type-Data check
    Acct-Interim-Interval reply
    Fall-Through reply

    Then I assigned this profile component to an new 50M Daily profile i created and assigned this profile to dvdwalt

    So I connected as dvdwalt and downloaded a few meg of data. Then (here please check if you get the same behavior)

    If I open the Radius client and test the authentication for dvdwalt; every time the usage increased of the connected session; the allowed data in the reply attribute decreased.

        Request Attributes
    
            User-Name = dvdwalt
            User-Password = dvdwalt
    
        Reply Attributes
    
            Mikrotik-Total-Limit = 43009197
            Acct-Interim-Interval = 60
            ChilliSpot-Max-Total-Octets = 43009197
    
    • Later I tested again:

      Request Attributes
      
          User-Name = dvdwalt
          User-Password = dvdwalt
      
      Reply Attributes
      
          Mikrotik-Total-Limit = 42945828
          Acct-Interim-Interval = 60
          ChilliSpot-Max-Total-Octets = 42945828
      

    Can you test and see if your system does the same?

    I'll try and solve the reset time issue today as well.

    Kind regards

     
  • Jimbob21

    Jimbob21 - 2013-11-27

    Hi Dirk,

    I have the same settings in my 50 Meg profile and a few others to limit bandwidth speed.

    If I connect and check on Radius client I get the same reply as you get (but with my info).
    If I connect a second client the reply shows both have been deducted.
    So I take it the Radius side is working and the disconnect is a problem.

    Hope this answers your question.

    Cheers,
    Jimmy

     
    • ZtarkVokehc

      ZtarkVokehc - 2013-11-27

      This feature is working well on my.

      Also, I used a ubuntu VM as my coovachilli server. My RD is on the cloud.

       
  • Dirk van der Walt

    Mmmmm, this is an interesting problem.

    So it seems that CoovChilli accepts the first connection for a user's limit (ChilliSpot-Max-Total-Octets).

    Then on subsequent connections it ignores any value for ChilliSpot-Max-Total-Octets for that connection.

    Unless their interpretation is then actually different from the way you and me interpret it and they apply the limitation to the user that connected and not per session. Let me see if I can twist someones arm just to also confirm on their setup since I haven't got a working setup in my reach right now.

    I'll then also ask on Linked-in since that seems to be the place where support is most active recently.

     
  • ZtarkVokehc

    ZtarkVokehc - 2013-11-27

    Hello JimBob,

    I have a fairly large deployment using RD as my AAA server.

    I can confirm that based on my experience, I can:

    1. have a profile with a fixed data cap which can be simultaneously used by a couple of users
    2. have a profile that imposes the data caps and refreshes at a fixed time - in my case, midnight.

    My server is located in the US, of which we also hosted one of the RD's development server.

    Initially, I had my data reset time problem but I got it fixed when I had my server's time properly set to MY time zone. (I am in Asia).

    I ran my coova network access controller separately on a ubuntu machine.

    Do you mind posting your profile and it's components?

     
  • Dirk van der Walt

    Hi Jimmy,

    I've actually managed to get a working setup running on my 'lab' at home where I'll do some more testing as I also want to cleat a few scenarios out for myself.

    Hope to give more feedback on the tests done here before Monday.

    PS: I've managed to get the mesh to terminate to a CoovaChilli Captive Portal (my working setup) and the tests I've done so far seems to be quite encouraging.

    http://www.radiusdesk.com/technical_discussions/batman_coova

     
  • Dirk van der Walt

    Hi Jimmy

    Daily Reset time -> Take 2

    I actually managed to tell you to modify the wrong file and left out a scenario where the person connects before the reset hour. In that case the previous day's accumulated data should apply.

    So the file to edit is actually /usr/locat/etc/raddb/reset_time_for_data.pl

    See the following snippet of code:

        sub start_of_day {
            #Get the current timestamp;
            my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
            #create a new timestamp:
            my $reset_hour = 10;
            #If the hour now is now before the reset hour; use the previous day
            if($hour < $reset_hour){
               $mday = $mday-1;
            }
            my $unixtime = mktime (0, 0, $reset_hour, $mday, $mon, $year, 0, 0);
            return $unixtime;
    
        }
    

    Try the above modification and remember to restart FreeRADIUS after the modification as it "pulls in" the files during start-up so modifications afterwards on the Perl scripts require a restart.

    Also remember (although I don't think it will be a problem with a local server) to confirm the localtime / timezone as Ztark pointed out since the calculations is done on the server itself.

     
  • Dirk van der Walt

    Hi Jimmy,

    I've just completed some tests on my side with a 50M cap and here is what I did as well as their results (which makes sense according to my logic)

    • I started clean and connected with my first machine. This allowed me do consume 50M on that session.
    • I consumed up to 25M of the cap and started a second session.
    • The second session allowed me to use 25M which is the remainder of the 50M cap.
    • The second session terminated as soon as the 25M was up.
    • The first session however still allowed me to complete the 50M which was allowed for that session.

    Here's the feedback from the coova_query command:

        root@OpenWrt:~# chilli_query list
        68-17-29-D2-44-55 10.1.0.4 pass 5299c67e00000002 1 dvdwalt 198/0 0/0 11724049/0 637543/0 24451985 0 0%/0 0%/0 http://www.radiusdesk.com
        08-ED-B9-00-33-44 10.1.0.3 pass 5299c5ca00000001 1 dvdwalt 915/0 19/0 23974957/0 1430408/0 49627951 0 0%/0 0%/0 http://www.radiusdesk.com
    

    Due to the loosely coupled way the counter work, this will be the situation where the total can overshoot a lot with the increase of simultaneous connections.

    A remedy for this will be to change RD to work similar to YFi. YFi has a feedback loop and will disconnect a user as soon as the total usage tipped the set cap (upon the Account update sent from CoovaChilli)

    Perhaps YFi will then be more suitable for this scenario instead of RD.

    Kind regards

     
  • Jimbob21

    Jimbob21 - 2013-11-30

    Hi Dirk,

    Thanks for Daily reset time Take 2 that has solved that problem.

    The multi sessions data usage problem we have decided to live with for now.

    The user inferface for Radiusdesk is much better than YFi and the hotel owner wants to stay with Radiusdesk. We have also changed the multi-sessions to only 2 instead of the earlier 3.

    Sorry I have taken so long before I came back to you but I was away for a few days.

    We will be putting the system into production from Monday and will monitor the usage. If we find this not suitable for the hotel we are going to change to 2 user accounts per room with a revised data cap.

    As soon as I have this 1 running I will be starting with a test setup for the other site as I have recieved my 12 Pico station, These 1's I will be trying with coova ap running on each 1.

    I will give feed back as soon as I can.

    Cheers,

    Jimmy

     
  • Jimbob21

    Jimbob21 - 2013-12-07

    HI Dirk,

    Just want to let you know that after all your/my changes I have put the system into production.

    All is running as we hoped, so for the combined usage per user runs at about 75 megs before cut-off, we are very happy with theser results.

    I must admit that even though the Radiusdesk is running on a old HP laptop it is very stable.

    I have started on my new project which will be controlled from Radiusdesk running on a VPS on Ubuntu 12.04 x64 and I have already added a few Dynamic devices which are working well so far.

    Any progress on your Mesh devolopment.

    Thanks again for all your help and fantasic program.

    Jimmy.

     
  • Dirk van der Walt

    Hi Jimmy,

    Thanks for the positive report. I'm glad that everything seems to be working well up to now.

    This past week I've spend some time to get the latest OpenWrt with Batman 12.4.0 running on the OM2P hardware and had some fairly good results eventually.

    I'm going to try and spend more time this week on the MESHdesk side of things especially the exit point definitions, as well as the node table.

    Perhaps early next week there will be something to try out.

    Kind regards

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.