Different bandwidth for Day & Night in FR
OS: Using Ubuntu / Freeradius for user authentication. NAS is mikrotik ver 6.x Scenario: I am trying to implement 'different bandwidth for day & night' from 8am-till-8pm > 1mb from 8pm-till-8am > 2mb I dont know much about freeradius inside core, therefore so far I have think of following, I have created separate table in which i have a dded username / bandwidth for night, start/end time / COA sent flag. mysql> select * from users_bwsch; +----+----------+-----------+----------+----------+------------------+----------------+ | id | username | bwpkg | start | end | start_alert_sent | end_alert_sent | +----+----------+-----------+----------+----------+------------------+----------------+ | 1 | zaib | 2048k/2048k | 11:00:00 | 20:00:00 | 0 | 0 | +----+----------+-----------+----------+----------+------------------+----------------+ I know howto use COA, but confused on howto do multiple IF statement in ACCOUNTING section 1) Using UNLAG query in FR , check the start and end time and match with NOW, if time matches, & start_alert_coa flag is 0 then send COA and update start_alert_sent to 1, when time ends, send COA to change pkg to original one and set FLAG end_alert_sent to 1, and something more ... OR 2) Using external script to do the checking and send COA using radclient? I believe there might be more suitable methods to achieve this , that is why I am seeking help from list members. Regards, Jz <http:///>
On Feb 7, 2018, at 4:23 AM, JAHANZAIB SYED <aacable@hotmail.com> wrote:
OS: Using Ubuntu / Freeradius for user authentication. NAS is mikrotik ver 6.x
Scenario: I am trying to implement 'different bandwidth for day & night'
from 8am-till-8pm > 1mb from 8pm-till-8am > 2mb
Changing bandwidth on the fly can be difficult.
I dont know much about freeradius inside core, therefore so far I have think of following,
I have created separate table in which i have a dded username / bandwidth for night, start/end time / COA sent flag.
mysql> select * from users_bwsch; +----+----------+-----------+----------+----------+------------------+----------------+ | id | username | bwpkg | start | end | start_alert_sent | end_alert_sent | +----+----------+-----------+----------+----------+------------------+----------------+ | 1 | zaib | 2048k/2048k | 11:00:00 | 20:00:00 | 0 | 0 | +----+----------+-----------+----------+----------+------------------+----------------+
I know howto use COA, but confused on howto do multiple IF statement in ACCOUNTING section
There are lots of examples in the default configuration files. Those should help.
1) Using UNLAG query in FR , check the start and end time and match with NOW, if time matches, & start_alert_coa flag is 0 then send COA and update start_alert_sent to 1, when time ends, send COA to change pkg to original one and set FLAG end_alert_sent to 1, and something more ...
OR
2) Using external script to do the checking and send COA using radclient?
Use an external script. FreeRADIUS only does things when it receives a packet. So if you want to do something at 8am and 8pm, and send CoA packets for 1000's of users, you'll need an external script. Alan DeKok.
Ok I made one script that runs on 8pm, and change bandwidth on the fly for users using RADCLIENT. so COA part is working fine, but the problem is if user disconnects and re connect, then he again assigned his normal package. Can i make some checks ? if user have 8pm-8am double speed pkg, then he should get pkg from different profile rather then its assigned profile? <http:///> ________________________________ From: Freeradius-Users <freeradius-users-bounces+aacable=hotmail.com@lists.freeradius.org> on behalf of Alan DeKok <aland@deployingradius.com> Sent: Wednesday, February 7, 2018 7:30 PM To: FreeRadius users mailing list Subject: Re: Different bandwidth for Day & Night in FR On Feb 7, 2018, at 4:23 AM, JAHANZAIB SYED <aacable@hotmail.com> wrote:
OS: Using Ubuntu / Freeradius for user authentication. NAS is mikrotik ver 6.x
Scenario: I am trying to implement 'different bandwidth for day & night'
from 8am-till-8pm > 1mb from 8pm-till-8am > 2mb
Changing bandwidth on the fly can be difficult.
I dont know much about freeradius inside core, therefore so far I have think of following,
I have created separate table in which i have a dded username / bandwidth for night, start/end time / COA sent flag.
mysql> select * from users_bwsch; +----+----------+-----------+----------+----------+------------------+----------------+ | id | username | bwpkg | start | end | start_alert_sent | end_alert_sent | +----+----------+-----------+----------+----------+------------------+----------------+ | 1 | zaib | 2048k/2048k | 11:00:00 | 20:00:00 | 0 | 0 | +----+----------+-----------+----------+----------+------------------+----------------+
I know howto use COA, but confused on howto do multiple IF statement in ACCOUNTING section
There are lots of examples in the default configuration files. Those should help.
1) Using UNLAG query in FR , check the start and end time and match with NOW, if time matches, & start_alert_coa flag is 0 then send COA and update start_alert_sent to 1, when time ends, send COA to change pkg to original one and set FLAG end_alert_sent to 1, and something more ...
OR
2) Using external script to do the checking and send COA using radclient?
Use an external script. FreeRADIUS only does things when it receives a packet. So if you want to do something at 8am and 8pm, and send CoA packets for 1000's of users, you'll need an external script. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Feb 8, 2018, at 12:34 PM, JAHANZAIB SYED <aacable@hotmail.com> wrote:
Ok I made one script that runs on 8pm, and change bandwidth on the fly for users using RADCLIENT. so COA part is working fine,
That's good.
but the problem is if user disconnects and re connect, then he again assigned his normal package.
Yes, you need to check when the user is logging in, and give the profile for the time period.
Can i make some checks ? if user have 8pm-8am double speed pkg, then he should get pkg from different profile rather then its assigned profile?
Yes. See: https://wiki.freeradius.org/config/run_time_variables You can check the current time, and give users different profiles, depending on the time period. Alan DeKok.
participants (2)
-
Alan DeKok -
JAHANZAIB SYED