FR with Mikrotik - FUP Quota Bandwidth not changing auto

Anirudh Malhotra 8zero2ops at gmail.com
Thu Mar 24 15:37:20 CET 2016


Hi,

Yes exactly NAS is doing what freeradius has asked it to do. It is disconnecting when the limit sent by radius is reached.

So in order to achieve what you want, remove the counter and use the query "SELECT SUM(AcctInputOctets)+SUM(AcctOutputOctets) FROM radacct
WHERE UserName='%{%k}'"

And if this goes greater than what is given in table for user then send an update coa.

Hope this helps

BR,
Anirudh Malhotra
8zero2
Mail: 8zero2.in at gmail.com
Facebook: www.facebook.com/8zero2
Twitter: @8zero2_in
Blog: blog.8zero2.in

On 24 Mar 2016, 19:58 +0530, AACABLE / Mikrotik System<aacable79 at gmail.com>, wrote:
> Greetings,
> 
> I have FR 2.x with Mikrotik 6.x. I want that when user quota limit end, his
> bandwidth package should change from 1mb to 512k. I have made counter and
> its working as expected. The only issue is that the changes are not being
> done on the fly. Changes applies only when user disconnects, and re-login.
> Same thing happens for users whose monthly quota limit finish but they are
> keep connected and gets denied only on re-login.
> 
> When I issue following command it works fine. (for the bandwidth COA and
> POD)
> 
> echo User-Name := "zaib", Mikrotik-Rate-Limit = 512k/512k | radclient -x
> 101.11.11.255:1700 coa 12345
> [Mikrotik accepts this command and change the bandwidth on the fly]
> 
> echo user-name=zaib | radclient -x 101.11.11.255:1700 disconnect 12345
> [Mikrotik accepts this command and disconnects the user as instructed]
> 
> How can I do this on the fly using FR? I know its the job of NAS but NAS
> will act only when FR will tell him to do so. Kindly assist.
> 
> 
> *SQL *Counter:
> *=============*
> counter-name = Mikrotik-Total-Limit
> check-name = Mikrotik-Total-Limit
> reply-name = Mikrotik-Total-Limit
> sqlmod-inst = sql
> key = User-Name
> reset = daily
> query = "SELECT SUM(AcctInputOctets)+SUM(AcctOutputOctets) FROM radacct
> WHERE UserName='%{%k}'"
> }
> *=============*
> *AUTHORIZE *Section:
> 
> dailyquota {
> reject = 1
> }
> if (reject) {
> ok
> update reply {
> Mikrotik-Rate-Limit := "512k/512k"
> Reply-Message := "You have reached your daily 300MB transfer limit.
> Enforcing 512k FUP Policy - zaib "
> }
> }
> *=============*
> 
> --
> Regard's
> JAY-Z
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list