Is there way to convert output octets and input octets to KB

Mustafa Nassir mustafa.n.gaid at gmail.com
Sun Jun 16 15:27:00 CEST 2019


yes , i tray to limit bandwidth download and upload so if users get all
limit they get access reject what is best way to limit it .
thank u your replay very helpful all things now clear ,

but from your first replay  u say

" If you're trying to enforce download limits on users, this isn't part of
standard RADIUS.  You cannot put Acct-Input-Octets into an Access-Accept,
and expect that the NAS will enforce that.  You have to read the NAS
documentation to see (1) if the NAS is capable of this, and (2) which
vendor-specific attributes to use. "

i need to limit total bandwidth octets not (rx/tx) limit

Note : i use my openwrt as nas ( wpa-enterprise )

On Sun, Jun 16, 2019 at 4:03 PM Alan DeKok <aland at deployingradius.com>
wrote:

> On Jun 16, 2019, at 7:56 AM, Mustafa Nassir <mustafa.n.gaid at gmail.com>
> wrote:
> >
> > ok , i need to limit total octets for users so i add sqlcounter :
> >
> > sqlcounter total_limit{
> >            counter_name = 'Max-Total-Bandwidth'
> >            check_name = 'Total-Bandwidth'
> >            sql_module_instance = sql
> >            key = 'User-Name'
> >            dialect = mysql
> >            reset = never
> >  query = "SELECT SUM(acctinputoctets) + SUM(acctoutputoctets) FROM
> radacct
> > WHERE UserName='%{${key}}'"
> > }
> >
> > its work fine for 4 GB but if i need to limit it to 10 GB or more the
> > server give another value not what i add some examble :
>
>   You shouldn't need to do that.  The sqlcounter module has supported
> 64-bit counters since 3.0.4, in 2014.
>
> > insert into radcheck (username,attribute,op,value) values ("sw392","
> > Cleartext-Password",":=","sw");
> > insert into radcheck (username,attribute,op,value) values ("sw392","
> > Monthly-Bandwidth ",":="," 10737418240");
> >
> > when i do radtest sw392 sw 127.0.0.1 10 XXXXX
> >
> > i get
> >
> > User-Name = "sw392"
> >        User-Password = "sw"
> >        NAS-IP-Address = 127.0.0.1
> >        NAS-Port = 10
> >        Message-Authenticator = 0x00
> >        Cleartext-Password = "sw"
> > Received Access-Accept Id 61 from 127.0.0.1:1812 to 0.0.0.0:0 length 26
> >        Session-Timeout = 2147483648
> >
> > the session-timeout is my Monthly-Bandwidth attribute as you see i get
> > different value from what i insert in sql
>
>   Yes, because Session-Timeout is a 32-bit integer.
>
>   If you're doing to put values larger than 4G into a 32-bit integer, it
> won't work.
>
>   If you're going to limit bandwidth by putting bandwidth values into
> Session-Timeout, it won't work.
>
>   The sqlcounter module supports 64-bit values just fine.   One issue,
> though is that the module is made to count *time* not *bandwidth*.  All of
> the documentation and examples show it counting time.  And when you test
> it, you see the module setting Session-Timeout.  *Not* any bandwidth
> limitation.
>
>   So again, what are you trying to do?  You've posted a configuration
> here, but you're not really describing the problem.
>
>   Are you trying to limit bandwidth that the users can download?  Did you
> *READ* my previous response which explained the problem with that?
>
>   Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list