Community discussions

MikroTik App
 
devrim
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Fri Sep 02, 2005 12:37 am

Radius Recv-Limit Question

Tue Oct 04, 2005 11:58 am

Hi all,

For several days i tried to learn all features of RouterOS..
Traffic limiting works very good in hotspot configuration.

I tried to understand how Xmit-Limit Recv-Limit attributes in
radius reply are work.

If i set this attribute how mikrotik knows user before traffic waste?

For instance;
i add user "foo" to my radius server. Also i add Recv-Limit reply attribute-value for this user. Say 100MB.

Then this user use hotspot service and waste 70MB traffic in this session..
Also hotspot configuration update accounting to our radius server.

So in next login howto mikrotik knows user foo Recv-Limit?
Because freeradius send again 100MB value..

So the problem arise in this step. Is mikrotik knows or count user before
traffic then subtract this traffic from radius reply item or
i must add some functions to my radius server for care this type of situation(IE check before traffic then substract from limit then set this attribute as new value )?

Thanks for reply..
devrim
 
edzix
Member
Member
Posts: 333
Joined: Thu Jul 01, 2004 3:01 pm
Location: Latvia

Tue Oct 04, 2005 5:59 pm

you should run some 3rd party script on each user 'foo' login which calculates how much does this user have additional MBs left and send this number back to the MT as Recv-Limit/Xmit-Limit.

Edgars
 
joeyconcrete
just joined
Posts: 14
Joined: Sun Jul 03, 2005 11:56 am
Location: Isle of Man, UK

Tue Oct 04, 2005 6:19 pm

Store the user parameters in a database (mySQL , PostGre etc). Get FreeRADIUS to get the attributes (Xmit-limit) from the database table and pass them to Mikrotik in the access-accept message. When the session ends, Mikrotik will send an accounting-stop message to RADIUS, take the bytes contained in this message and deduct it from the original amount in the database.

I've done this successfully using Radiator talking to MSSQL. Radiator supports events when it receives accounting-stop packets. You could always use database triggers if you preferred.
 
devrim
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Fri Sep 02, 2005 12:37 am

Tue Oct 04, 2005 10:31 pm

Hi,

First of all thanks for your reply..
I understand MT behaviour. So now i need some implementation for freeradius..

But i wonder another thing.. As you know MT send radius accounting information
depend to interval setting if configured. My understand this datas send Radius
as accounting update request in that time interval . And radius server update their accounting info with coming values.

My question, is MT reset their counter before send radius or send icreased values in
accounting update request? I know this is very silly question. But i have no time to investigate this case.

Regards..
devrim