I've added this block to radiusd.conf

sqlcounter monthlytrafficcounter {
    vcounter-name = Monthly-Traffic
    check-name = Max-Monthly-Traffic
    reply-name = Monthly-Traffic-LIMIT
    sqlmod-inst = SQL
    key = User-Name
    reset = monthly
    query = "SELECT SUM(acctinputoctets + acctoutputoctets) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) > '%b'"

and added the dictionary

ATTRIBUTE Max-Monthly-Traffic 3003 integer
ATTRIBUTE Monthly-Traffic-Limit 3004 integer

then added monthlytrafficcounter to authorize in /etc/freeradius/sites-enabled/default

but it doesn't work

The Max-Monthly-Traffic is defined in MySQL table radgroupcheck and the users were added to the group in radusergroup

Although a user has reached the traffic limit, he still can be authorized by FreeRadius


Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.