Possibility to create a counter for "traffic volume" WITHOUT sql ?
Nachtfalke
nachtfalkeaw at web.de
Wed Feb 15 20:07:31 CET 2012
Hi,
I am using freeradius 2.1.12 and the rlm_counter module for counting amount
of time. So an user has got only 60min per day, week, month or forever. As
far as I can see that this is working as it should. User cannot reconnect if
he used more time than allowed.
This is how my counter module looks like:
-------------------------------------------
counter daily {
filename = ${raddbdir}/db.daily
key = User-Name
count-attribute = Acct-Session-Time
reset = daily
counter-name = Daily-Session-Time
check-name = Max-Daily-Session
reply-name = Session-Timeout
cache-size = 5000
}
-------------------------------------------
The corresponding "users" file looks like that. Limit is 3600 seconds.
-------------------------------------------
"username" Cleartext-Password := "password", Max-Daily-Session := 3600
-------------------------------------------
Then I thought I could just simple make a traffic counter with this module
and I did that:
-------------------------------------------
counter maxdailydownload {
filename = ${raddbdir}/db.maxdailydownload
key = User-Name
count-attribute = Acct-Output-Octets
reset = daily
counter-name = Daily-Output-Octets
check-name = Max-Daily-Output
reply-name = Acct-Output-Octets
cache-size = 5000
}
-------------------------------------------
The corresponding "users" file looks like that. Limit is 1000000000 which
should be ~1GB
-------------------------------------------
"username" Cleartext-Password := "password", Max-Daily-Output := 1000000000
-------------------------------------------
But as I know now this isn't working. The main problem is - as far as I
understand this - that the module counts time and replies "Session-Timeout"
and this makes problem when counter should reset daily. Unfortunately I
didn't understand it completly. Somewhere on the mailing-list I found I
thread where they discussed about that problem and that it should work when
using "reset = forever". I tried that but it seems not to work. The user
only can download much less than 1GB. Perhaps this could be a problem of my
NAS (pfSense Captive Portal which perhaps sends wrong "Acct-Output-Octets"
values).
The other problem is that if the check-item value of "Max-Daily-Output" is
too hight - probably 32bit limit - it doesn't work, too.
Then I bought a book about freeRadius "FreeRADIUS - Beginners Guide by Dirk
van der Walt" and he is describing the same problem with the rlm_counter and
counting traffic. He wrote a perl script which counts traffic but the
"problem" is that he is using an SQL database.
The NAS I am using for this is - I mentioned it above - pfSense
CaptivePortal. It sends Acct-Input-Octets, Acct-Input-Octets,
Acct-Input-Gigawords, Acct-Output-Gigawords.
My question is now:
1. Is it possible in general to create a data counter without using any
external database but just with tools freeradius2 comes with ?
2. Has somebody coded such a module, script oder something als and could
post this here ?
3. Will there be an (easier) way on freeradius3 or a module which covers
this feature ?
Thank you very much in advance for your help and answers!
Alexander
More information about the Freeradius-Users
mailing list