<div dir="ltr"><div><div><div><span style="font-family:georgia,serif">Hi, Here i would explain daily counter. if you need weekly, monthly, forever, volume quota  do the same. <b><br><br><span style="color:rgb(255,0,0)">Note:</span> </b>The Counter For Volume Quota Is Different <br></span></div><div><span style="font-family:georgia,serif"><br></span></div><span style="font-family:georgia,serif">1.) Create SQL Counter <br><br>sqlcounter <b>dailycounter </b>{<br>                counter-name = "Daily-Session-Time"<br>                check-name = "<b>Max-Daily-Session</b>"<br>                reply-name = "Session-Timeout"<br>                sqlmod-inst = "sql"<br>                key = "User-Name"<br>                reset = "daily"<br>                cache-size = 5000<br>                query = "SELECT SUM(acctsessiontime) FROM radacct WHERE username = '%{%k}' AND acctstarttime BETWEEN FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')"<br><br></span></div><span style="font-family:georgia,serif">2.) Enable Counter in  "</span><span style="font-family:georgia,serif"><span style="font-family:georgia,serif">/etc/freeradius/</span>radiusd.conf"<br><br>instantiate {<br><b> dailycounter</b><br></span></div><span style="font-family:georgia,serif">more entries..<br>} <br></span><div><span style="font-family:georgia,serif"><br></span></div><div><span style="font-family:georgia,serif">3.) Enable Counter in "default virtual server" /etc/freeradius/sites-available/default<br></span></div><div><span style="font-family:georgia,serif"><br></span><div><span style="font-family:georgia,serif">authorize {<br><b>dailycounter</b><br>more entries..<br>} <br><br><br></span></div><div><span style="font-family:georgia,serif">4.) Restart FreeRADIUS, If problem see in debug. <br><br><br></span></div><div><span style="font-family:georgia,serif">5.) Apply Attributes To User<br><br>Check items<br>Max-Daily-Session := 3600<br><br></span></div><div><span style="font-family:georgia,serif">Reply Item: <br>Max-Daily-Session := 3600<br><br><br></span></div><div><span style="font-family:georgia,serif">All This Should Do.. <br></span></div><div><br><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 19, 2014 at 9:27 AM, anusha mule <span dir="ltr"><<a href="mailto:anusha.mule9988@gmail.com" target="_blank">anusha.mule9988@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><br>
<div style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">Hi, </font></font></div>
<div style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"></font> </div>
<div style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">We have the following understanding RADIUS Authentication and Accounting flow :-</font></font></div>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt 0.5in"><span><span><font face="Calibri" size="3">1.</font><span style="FONT:7pt 'Times New Roman'">       </span></span></span><font size="3"><font face="Calibri">When the Access-request from the NAS, Server will search in the radcheck table to check the attributes for the user.</font></font></p>
<p style="MARGIN:0in 0in 0pt 0.5in"><span><span><font face="Calibri" size="3">2.</font><span style="FONT:7pt 'Times New Roman'">       </span></span></span><font size="3"><font face="Calibri">If check attributes are found and its matches to the user, then the server will pull the reply items (Attributes like Bandwidth, Volume, Timeout, etc) from the radreply table for this user and add it in the Access-Accept packet.</font></font></p>
<p style="MARGIN:0in 0in 0pt 0.5in"><span><span><font face="Calibri" size="3">3.</font><span style="FONT:7pt 'Times New Roman'">       </span></span></span><font size="3"><font face="Calibri">On receiving Access-Accept packet, session will get established for the user and Accounting-Start message will get transmitted to the Server.</font></font></p>
<p style="MARGIN:0in 0in 0pt 0.5in"><span><span><font face="Calibri" size="3">4.</font><span style="FONT:7pt 'Times New Roman'">       </span></span></span><font size="3"><font face="Calibri">The server will update the radacct table with Accounting start message.</font></font></p>
<p style="MARGIN:0in 0in 0pt 0.5in"><span><span><font face="Calibri" size="3">5.</font><span style="FONT:7pt 'Times New Roman'">       </span></span></span><font size="3"><font face="Calibri">When the station get disconnected, Session should get deleted and Accounting-Stop message should sent to the Server including user statistics (like Session-time, input-octets, output-octets, etc)in it.</font></font></p>
<p style="MARGIN:0in 0in 0pt 0.5in"><span><span><font face="Calibri" size="3">6.</font><span style="FONT:7pt 'Times New Roman'">       </span></span></span><font size="3"><font face="Calibri">Server will update the radacct table with all the attributed present in the STOP message.</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">With let us consider the following simple scenario :-</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">RADIUS Server having User details as </font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">User Name = Joe</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">Password <span>   </span>= Joe123</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">Timeout <span>     </span>= 30000 Secs</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">Step 1: During the initial connect<span>  </span>- User should be authenticated and Access-Accept should contains the attribute value as 30000 Secs, </font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri"><span>              </span>mentioning the max duration that the user session is allowed.</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri"><span>              </span>Once the session is established, RADIUS Accounting Start message is send to RADIUS server.</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri"><span>               </span>Next let us say, User has been disconnected after 20000 Secs.</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri"><span>               </span>Again, the RADIUS Accounting Stop message with the consumed duration of 20000 Secs shall be send to the RADIUS Server.</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">Step 2:<span>   </span>Now, when the same user tries to authenticate, he should be authenticated and the Access-Accept provide the Timeout attribute as 10000 Secs ( i.e. 30000 Secs – 20000 Secs)</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri"><span>                 </span>Here, let us assume the user used the full session duration and get time out.</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri"><span>               </span>Again, the RADIUS Accounting Stop message with the consumed duration of 10000 Secs shall be send to the RADIUS Server.</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri"><span>               </span></font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">Step 3:<span>   </span>Now, when the same user tries to authenticate, he should be rejected. </font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">How can the above be achieved using radius server configurations.</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3"> </font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">Kindly help us in this.</font></font></p><br clear="all">
<div>
<div>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">Thanks in advance.</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri"></font></font> </p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font size="3"><font face="Calibri">Thank you & Regards,</font></font></p>
<p style="MARGIN:0in 0in 0pt" class="MsoNormal"><font face="Calibri" size="3">Anusha M</font></p></div></div></div><br>
<br>-<br>
List info/subscribe/unsubscribe? See <a href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a><br></blockquote></div><br></div>