How to use sqlcounter to disconnect a user after reaching the daily quota?

Nathan Ward lists+freeradius at
Mon Jan 1 02:21:37 CET 2018

> On 31/12/2017, at 10:31 AM, Houman <houmie at> wrote:
> Alan,
> It works! Thank you so much for the code snippets.  I wasn't that far off
> after all it seems.  Btw I have inserted the integer64 at the end of the
> dictionary file.  I think this is the right way judging by the existing
> samples in the file.
> ATTRIBUTE       My-Daily-Usage 3001 integer64
> I'm happy with the solution to disallow the user entirely once the
> daily-usage has been reached. My only concern is if there is an easy way to
> convey a message back to the client, to inform the user why the VPN
> connection is failing?

This does not achieve what you want, by itself.
1) Sessions that span multiple days will break your logic. In your stack overflow post you’re actually looking at usage for the whole month, not a day.
2) A user will not be disconnected when they reach their limit, as your NAS doesn’t support that.

If what you’ve got here is fine for you then that’s fine I guess - but it's not something I’d put in to production.

> Maybe something like this?
>        update reply {
>                Reply-Message := "You have reached your bandwidth limit"
>        }

That will set the Reply-Message attribute in the reply. No idea if your NAS will do what you want with that, though.

Nathan Ward

More information about the Freeradius-Users mailing list