I have a working FreeRadius installation used for PPPOE
clients using a Mikrotik NAS (Essentialy Linux)
I am using Freeradius to limit data a user can send/receive
within a month and automatically reset it every month.
I used an example from chilliuspot hotspot for this.
However what im noticing is sometimes a customer gets denied
access because he has exceeded he’s monthly allowance, however when I check
the
Db this is not the case cause it’s the beginning of
month.
This only happens sometimes so im lost!
I use sqlcounter.conf for the counter part of things and
INCLUDE this from radius.conf.
sqlcounter monthlytraffic {
counter-name = Monthly-Traffic
check-name = Max-Monthly-Traffic
reply-name = Mikrotik-Xmit-Limit-Gigawords
sqlmod-inst = sql
key = User-Name
reset = monthly
query = "SELECT SUM(AcctInputOctets - GREATEST((%b -
UNIX_TIMESTAMP(AcctStartTime)), 0))+ SUM(AcctOutputOctets -GREATEST((%b -
UNIX_TIMESTAMP(AcctStartTime)), 0)) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime)
+ AcctSessionTime > '%b'"
}
Anybody for input? I would greately appreciate help here! A
Work around is to simply increase he’s allowance till he is allowed to
connect!