Howto provide free airtime or no accounting in night for quota base user
Scenario: 1) Mikrotik as NAS 2) FREERADIUS as billing server Q1- Suppose, we have few quota base services and our internet bandwidth generally remains empty in night. therefore we want to provide free internet usage by bypassing quota counters in night. like from 8pm till 8am. Q2- This might not be related to FR. Some ISP's provide unlimited data access for FB,YT, whatsapp and other specific without any limit? how they do this? how they bypass accounting for such contents? from there NAS level or via using some magical code in FR ? Regards, Jz <http:///>
On Wed, 2018-01-24 at 09:08 +0000, JAHANZAIB SYED wrote:
Q2- This might not be related to FR. Some ISP's provide unlimited data access for FB,YT, whatsapp and other specific without any limit? how they do this? how they bypass accounting for such contents? from there NAS level or via using some magical code in FR ?
Likely either support from the NAS by reporting different network usage per application by traffic sniffing, or routing network traffic for certain networks around the NAS. Nothing in FR can do this directly. It just processes what it's sent from the NAS. FreeRADIUS doesn't see the network traffic. -- Matthew
some smarts elsewhere would ensure that traffic to certain services is umlimited - eg use routing to ensure that such traffic doesnt go through a metered link. your overnight question could probably be done in FR currently - in your accounting section(s) you would need to wrap your current calls with some unlang that checks the timestamp of the packet and only proceeds if the time is not within a particular range.there would have to be some other logic for the accounting stop ..you've ignored the interim-uddates? no, they'd have to go into some other increment table and then taken off the final stop packet... alan
Ok my understanding is once a user is connected to the NAS, all accounting will transfer to the FR radacct table via interim update and we cannot exclude specific sites accounting. Ok for specific users (group) we have to create some magical code in FR that should check for specific user details and if the user service allows free airtime, then donot update the radacct table or less the data ? I dont need exact codes but still i am looking for some more directions if possible. Thank you ________________________________ From: Freeradius-Users <freeradius-users-bounces+aacable=hotmail.com@lists.freeradius.org> on behalf of Alan Buxey <alan.buxey@gmail.com> Sent: Wednesday, January 24, 2018 5:32 PM To: FreeRadius users mailing list Subject: Re: Howto provide free airtime or no accounting in night for quota base user some smarts elsewhere would ensure that traffic to certain services is umlimited - eg use routing to ensure that such traffic doesnt go through a metered link. your overnight question could probably be done in FR currently - in your accounting section(s) you would need to wrap your current calls with some unlang that checks the timestamp of the packet and only proceeds if the time is not within a particular range.there would have to be some other logic for the accounting stop ..you've ignored the interim-uddates? no, they'd have to go into some other increment table and then taken off the final stop packet... alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html Support & Services<http://www.freeradius.org/list/users.html> www.freeradius.org The world's leading RADIUS server. The project includes a GPL AAA server, BSD licensed client and PAM and Apache modules. Full support is available from NetworkRADIUS.
not magical code, just unlang man unlang then in the accounting section, wrap your current accounting process (your call to sql or whatever) with some logic to ensure its only called if relevant ...but as i said, theres likely to be other logic needed (dealing with accounting stop packets if they provide a final data count etc) alan On 25 January 2018 at 08:04, JAHANZAIB SYED <aacable@hotmail.com> wrote:
Ok my understanding is once a user is connected to the NAS, all accounting will transfer to the FR radacct table via interim update and we cannot exclude specific sites accounting. Ok for specific users (group) we have to create some magical code in FR that should check for specific user details and if the user service allows free airtime, then donot update the radacct table or less the data ? I dont need exact codes but still i am looking for some more directions if possible.
Thank you
________________________________ From: Freeradius-Users <freeradius-users-bounces+aacable=hotmail.com@lists.freeradius.org> on behalf of Alan Buxey <alan.buxey@gmail.com> Sent: Wednesday, January 24, 2018 5:32 PM To: FreeRadius users mailing list Subject: Re: Howto provide free airtime or no accounting in night for quota base user
some smarts elsewhere would ensure that traffic to certain services is umlimited - eg use routing to ensure that such traffic doesnt go through a metered link.
your overnight question could probably be done in FR currently - in your accounting section(s) you would need to wrap your current calls with some unlang that checks the timestamp of the packet and only proceeds if the time is not within a particular range.there would have to be some other logic for the accounting stop ..you've ignored the interim-uddates? no, they'd have to go into some other increment table and then taken off the final stop packet...
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html Support & Services<http://www.freeradius.org/list/users.html> www.freeradius.org The world's leading RADIUS server. The project includes a GPL AAA server, BSD licensed client and PAM and Apache modules. Full support is available from NetworkRADIUS.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Jan 25, 2018, at 3:04 AM, JAHANZAIB SYED <aacable@hotmail.com> wrote:
Ok my understanding is once a user is connected to the NAS, all accounting will transfer to the FR radacct table via interim update and we cannot exclude specific sites accounting. Ok for specific users (group) we have to create some magical code in FR that should check for specific user details and if the user service allows free airtime, then donot update the radacct table or less the data ? I dont need exact codes but still i am looking for some more directions if possible.
The problem is that the sessions span the "free" time. So you need a way to: 1) log all session data 2) log *only* session data for the "free" time. 3) subtract one from the other This isn't a trivial thing to do, unfortunately. It's all DB manipulation. My $0.02 is to write all accounting packets as normal. This addresses (1). You will need to record the data usage for the users session at the *start* of the free time, and again at the *end* of the free time. If the session lasts more than a day, then you will need to track free time for each day. Or, if you only care about the total free time per session, you could probably come up with a simpler approach. Just extend the radacct table with another column or two "freeinputoctets" and "freeoutputoctets". These should be the same data types as "acctinputoctets" and "acctoutputoctets". Edit raddb/dictionary, and add: ATTRIBUTE My-Free-Input-Octets 3000 integer64 ATTRIBUTE My-Free-Output-Octets 3001 integer64 ATTRIBUTE My-Acct-Input-Octets 3002 integer64 ATTRIBUTE My-Acct-Output-Octets 3003 integer64 ATTRIBUTE My-Acct-Packet-Input-Octets 3004 integer64 ATTRIBUTE My-Acct-Packet-Output-Octets 3005 integer64 The first 4 attributes will mirror what's in the SQL database. And let you do math with named attributes, which is always useful. The last 2 attribute are needed only because RADIUS doesn't define 64-bit counters... Then when a packet is received, do: * if it's during the free time, do something like: update request { My-Free-Input-Octets := "%{SELECT "freeinputoctets" from the table} My-Free-Output-Octets := "%{SELECT "freeoutputoctets" from the table} My-Acct-Input-Octets := "%{SELECT "acctinputoctets" from the table} My-Acct-Output-Octets := "%{SELECT "acctinputoctets" from the table} My-Acct-Packet-Input-Octets := "%{expr:%{Acct-Input-Octets} + %{Acct-Input-Gigawords} << 32}" My-Acct-Packet-Output-Octets := "%{expr:%{Acct-Output-Octets} + %{Acct-Output-Gigawords} << 32}" } That gets you the *current* state of what's going on. Then, figure out the difference between the various quantities: update request { My-Free-Input-Octets := %{expr:%{My-Free-Input-Octets} + %{My-Acct-Packet-Input-Octets} - %{My-Acct-Input-Octets}} My-Free-Output-Octets := %{expr:%{My-Free-Output-Octets} + %{My-Acct-Packet-Output-Octets} - %{My-Acct-Output-Octets}} } And then update the various SQL queries to write the My-Free-Input-Octets to the "freeinputoctets" column. It's not pretty, but it should work. Alan DeKok.
participants (4)
-
Alan Buxey -
Alan DeKok -
JAHANZAIB SYED -
Matthew Newton