Find the user whose data is beyond 1 GB running this query into your database. SELECT ((SUM(AcctInputOctets)+SUM(AcctOutputOctets))) FROM radacct WHERE UserName='your_username' Try to authenticate this user using your nas. Check if this gets authentication denied. If yes your counter is working fine. Now you problem of disconnecting user after 1GB limit: 1. You dont need to send disconnection request from radius to your NAS. NAS should know how to disconnect user upon data limit. (Mikrotik does it with Mikrotik-Total-Limit attribute). 2. You need to send the value of Mikrotik-Total-Limit to the NAS via radreply attribute. I do this in post-auth section of sites-enable/default Also all of my NAS send 5 minutes updates to freeradius, 10 seconds is too often(this comment however is not related to your question). On Sun, Aug 28, 2016 at 10:42 PM, Mohamad Yazdian <m.programer@gmail.com> wrote:
I think I have problem with sqlcounter...!!! I can't monitor periodicaly user information from radacct. My NAS send each 10 second data to my freeradius so freeradius get this data and save they on the radacct table but I can't rum the appropriate event between them. For example when total download /upload user from radacct > 1G then disconnect the user connection. I can not see any request on the Mikrotik Radius Incoming.
I do much more google it but just I find this configuration for freeradius sqlcounter but it's not work fine.
On Sun, Aug 28, 2016 at 1:00 PM, < freeradius-users-request@lists.freeradius.org> wrote:
Send Freeradius-Users mailing list submissions to freeradius-users@lists.freeradius.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.freeradius.org/mailman/listinfo/freeradius-users or, via email, send a message with subject or body 'help' to freeradius-users-request@lists.freeradius.org
You can reach the person managing the list at freeradius-users-owner@lists.freeradius.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of Freeradius-Users digest..."
Today's Topics:
1. Re: Disconnect user when hit bandwith (Alan DeKok) 2. Re: Disconnect user when hit bandwith (Vijay S)
----------------------------------------------------------------------
Message: 1 Date: Sat, 27 Aug 2016 07:58:42 -0400 From: Alan DeKok <aland@deployingradius.com> To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org> Subject: Re: Disconnect user when hit bandwith Message-ID: <0B7ADD16-C1B8-4E76-B03F-F0AB4DA6DCD2@deployingradius.com> Content-Type: text/plain; charset=us-ascii
On Aug 26, 2016, at 2:10 PM, Mohamad Yazdian <m.programer@gmail.com> wrote:
I use the Mikrotik-Total-Limit in my sqlcounter and add this counter name on the radcheck table for my users so when my users hit the 1G bandwith (1 week etc.) the connections are not droped...!!!
Ask Mikrotik why their NAS doesn't work.
Alan DeKok.
------------------------------
Message: 2 Date: Sun, 28 Aug 2016 12:09:43 +0530 From: Vijay S <vijay.hcr@gmail.com> To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org> Subject: Re: Disconnect user when hit bandwith Message-ID: <CAPTJ3-drCEwsDgxJC+QeXxkKrKexDOAQQg9Yw8999DERmHyo UQ@mail.gmail.com> Content-Type: text/plain; charset=UTF-8
Hi Mohamad, Set reply value of 1g manually for user and see if it disconnect on usage of 1g in mikrotik nas before diving into freeradius configuration details. Once you sure that your nas is doing what it meant to do then you can start digging into FR config.
Regards Vijay A. +91 9930804010
On Aug 26, 2016 11:41 PM, "Mohamad Yazdian" <m.programer@gmail.com> wrote:
Hello I use freeradius for authenticate my PPPoE users and I NAS router is mikrotik. every think is fine like as authentication and expiration in the monthly date but now I like to limit my users for 1G downloadn per month but when I make a sqlcounter and add this counter to the site-available default (authorize{}).
I use the Mikrotik-Total-Limit in my sqlcounter and add this counter name on the radcheck table for my users so when my users hit the 1G bandwith (1 week etc.) the connections are not droped...!!! But when the users disconnect the pppoe connection and try again to connect get the access denied message.
I like to dissconnect the pppoe connection when hit 1G.
Please advise me how to solve this issue.
Thank you
sqlcounter sample_Limit{ counter-name = Mikrotik-Total-Limit check-name = Mikrotik-Total-Limit reply-name = Mikrotik-Total-Limit sqlmod-inst = sql key = User-Name reset = never query = "SELECT ((SUM(AcctInputOctets)+SUM(AcctOutputOctets))) FROM radacct WHERE UserName='%{%k}'" }
sample_Limit{ reject = 1 } if(reject){ update reply { Reply-Message := "You have reached your bandwidth limit" } reject } - List info/subscribe/unsubscribe? See http://www.freeradius.org/ list/users.html
------------------------------
Subject: Digest Footer
- List info/subscribe/unsubscribe? See http://www.freeradius.org/ list/users.html
------------------------------
End of Freeradius-Users Digest, Vol 136, Issue 55 *************************************************
- List info/subscribe/unsubscribe? See http://www.freeradius.org/ list/users.html
-- Dinesh Bhardwaj Chief Technology Officer Rural Broadband Pvt. Ltd. www.airjaldi.com Tel. (91) 985-757-0709 Skype: dineshbhardwaj