On Fri, 3 Nov 2000, Ina Patricia Lopez wrote:
..
> im using radius with cisco as5300 and my redhat box as radius server,
> how do i implement prepaid internet access? how would my NAS/RAS know
> that this particular user should be cut bcoz his prepaid card has been
> used up already?
>
> can u pls enlighten me about this prepaid internet access?
it's complicated. basically you need to keep track of a given account's
usage in realtime. this is what happens: when an Auth-Request packet is
received, you get that user's total usage:
SELECT SUM(AcctSessionTime) FROM RadAcct WHERE UserName = ?
then, you find out how many credits s/he has remaining, for example,
SELECT Credits FROM Users WHERE UserName = ?
then you subtract the total usage from the credits (assuming that credits
are NEVER updated, IOW the Users.Credits never debits):
$seconds_left = Credits - SUM(AcctSessionTime)
finally, in the Auth-Accept reply packet, you set the following attributes
to $seconds_left:
Session-Timeout
Ascend-Maximum-Time
Note: we have observed that on a cisco 3640 with IOS 12.0(7) the router
doesn't properly obey the Session-Timeout. i dont know if this is an IOS
bug or what.. on a 5300, MAX TNT, bay 5399 (all the ones i've had the
opportunity to test) it works fine, though.
obviously, it's kinda hard to do prepaid if you're using something
medieval like cistron radius (try doing SQL queries on that!!)
i'd try steel-belted radius for NT, radiator or icradius for unix.
another thing: if you're using icradius or any radius that talks to mysql,
SELECT SUM(AcctSessionTime) is a bad idea: it locks the entire table, and
since your radius is simultaneously inserting into the same table, you'll
get race conditions aplenty. with oracle which has multiversioning, its ok
though...
> h&k,
> ina patricia
pwede toblerone?
---------------------------------------------------------------------
Orlando Andico <[EMAIL PROTECTED]> POTS Phone: +63 (2) 937-2293
Mosaic Communications, Inc. GSM Mobile: +63 (917) 531-5893
I'm not suffering from insanity -- I'm enjoying every minute of it!!
_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]