<div dir="ltr"><div><div><font size="4"><span style="font-family:garamond,serif">1.) You make sure accounting is working<br></span></font></div><font size="4"><span style="font-family:garamond,serif">2.) Your SQL counters are working<br></span></font></div><div><font size="4"><span style="font-family:garamond,serif">3.) You have set proper radius attributes <br><br></span></font></div><div><font size="4"><span style="font-family:garamond,serif">if you are using chilli NAS then "ChilliSpot-Max-Total-Octets" <span style="color:rgb(255,0,0)">AS CHECK ITEM & REPLY ITEM AS WELL</span> would be the attribute to control. <br><br></span></font></div><div><font size="4"><span style="font-family:garamond,serif">Thanks<br></span></font></div><div><font size="4"><span style="font-family:garamond,serif">RM --<br></span></font></div><div><div><div><br><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 26, 2014 at 2:39 PM, Xin <span dir="ltr"><<a href="mailto:knightluffy@live.com" target="_blank">knightluffy@live.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
I want to send disconnect message to the user who has exceeded the limited<br>
traffic. I have done the following steps:<br>
1. Create a sqlCounter:<br>
sqlcounter monthlytrafficcounter {<br>
counter-name = Monthly-Traffic<br>
check-name = Max-Monthly-Traffic<br>
reply-name = Monthly-Traffic-Limit<br>
sqlmod-inst = sql<br>
key = User-Name<br>
reset = monthly<br>
query = "SELECT SUM(acctinputoctets + acctoutputoctets) FROM radacct<br>
WHERE U serName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) > '%b'"<br>
}<br>
<br>
2. add the monthlytrafficcounter to "sites-enabled/default" authorize<br>
section.<br>
<br>
3. It worked when user login to NAS(NAS reject the user's request), but<br>
failed when the user connection connected. The Accounting request like<br>
following below:<br>
================================================================<br>
rad_recv: Accounting-Request packet from host NAS-IP port 48378, id=188 ,<br>
length=175<br>
Acct-Status-Type = Interim-Update<br>
Acct-Session-Id = "1411720910-19"<br>
NAS-Port-Type = Virtual<br>
Service-Type = Framed-User<br>
NAS-Port = 19<br>
NAS-Port-Id = "radius"<br>
NAS-IP-Address = NAS-IP<br>
Called-Station-Id = "NAS-IP[4500]"<br>
Calling-Station-Id = "User-IP[5476]"<br>
User-Name = "kirito"<br>
Framed-IP-Address = 10.0.0.1<br>
Acct-Output-Octets = 549938<br>
Acct-Output-Packets = 602<br>
Acct-Input-Octets = 77110<br>
Acct-Input-Packets = 785<br>
Acct-Session-Time = 122<br>
NAS-Identifier = "strongSwan"<br>
# Executing section preacct from file<br>
/usr/local/etc/raddb/sites-enabled/default<br>
+group preacct {<br>
++[preprocess] = ok<br>
[acct_unique] Hashing 'NAS-Port = 19,NAS-Identifier =<br>
"strongSwan",NAS-IP-Addres s = NAS-IP,Acct-Session-Id =<br>
"1411720910-19",User-Name = "kirito"'<br>
[acct_unique] Acct-Unique-Session-ID = "afe2593237df22fa".<br>
++[acct_unique] = ok<br>
[suffix] No '@' in User-Name = "kirito", looking up realm NULL [suffix] No<br>
such realm "NULL"<br>
++[suffix] = noop<br>
+} # group preacct = ok<br>
# Executing section accounting from file<br>
/usr/local/etc/raddb/sites-enabled/defa<br>
ult<br>
+group accounting {<br>
[detail] expand: %{Packet-Src-IP-Address} -> NAS-IP<br>
[detail] expand:<br>
/usr/local/var/log/radius/radacct/%{%{Packet-Src-IP-Addr<br>
ess}:-%{Packet-Src-IPv6-Address}}/detail-%Y%m%d -><br>
/usr/local/var/log/radius/rad<br>
acct/NAS-IP/detail-20140926<br>
[detail]<br>
/usr/local/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-<br>
Src-IPv6-Address}}/detail-%Y%m%d expands to<br>
/usr/local/var/log/radius/radacct/11<br>
<a href="http://6.251.216.197/detail-20140926" target="_blank">6.251.216.197/detail-20140926</a><br>
[detail] expand: %t -> Fri Sep 26 21:19:07 2014<br>
++[detail] = ok<br>
[sql] expand: %{Stripped-User-Name} -><br>
[sql] ... expanding second conditional<br>
[sql] expand: %{User-Name} -> kirito<br>
[sql] expand: %{%{User-Name}:-DEFAULT} -> kirito<br>
[sql] expand: %{%{Stripped-User-Name}:-%{%{User-Name}:-DEFAULT}} -> kirito<br>
[sql] sql_set_user escaped user --> 'kirito'<br>
[sql] expand: %{Acct-Input-Gigawords} -><br>
[sql] ... expanding second conditional<br>
[sql] expand: %{Acct-Input-Octets} -> 77110<br>
[sql] expand: %{Acct-Output-Gigawords} -><br>
[sql] ... expanding second conditional<br>
[sql] expand: %{Acct-Output-Octets} -> 549938<br>
[sql] expand: UPDATE radacct SET<br>
framedipadd<br>
ress = '%{Framed-IP-Address}', acctsessiontime =<br>
'%{Acct-Sessio<br>
n-Time}', acctinputoctets = '%{%{Acct-Input-Gigawords}:-0}'<br>
<<<br>
32 | '%{%{Acct-Input-Octets}:-0}',<br>
acctoutputoctets = '%{%{Acct-Output-Gigawords}:-0}' << 32 |<br>
'%{%{Acct-Output-Octets}:-0}' WHERE<br>
acctsessioni<br>
d = '%{Acct-Session-Id}' AND username = '%{SQL-User-Name}'<br>
AND nasipaddress = '%{NAS-IP-Address}' -> UPDATE radacct<br>
SET framedipaddress = '10.0.0.1',<br>
acctsessionti<br>
me = '122', acctinputoctets = '0' << 32 |<br>
'77110', acctoutputoctets = '0' << 32 |<br>
'549938' WHERE acctsessionid =<br>
'14117209<br>
10-19' AND username = 'kirito' AND na<br>
rlm_sql (sql): Reserving sql socket id: 12 rlm_sql (sql): Released sql<br>
socket id: 12<br>
++[sql] = ok<br>
++[exec] = noop<br>
[attr_filter.accounting_response] expand: %{User-Name} -> kirito<br>
attr_filter: Matched entry DEFAULT at line 12<br>
++[attr_filter.accounting_response] = updated<br>
+} # group accounting = updated<br>
Sending Accounting-Response of id 188 to NAS-IP port 48378 Finished request<br>
6.<br>
Cleaning up request 6 ID 188 with timestamp +157 Going to the next request<br>
Ready to process requests.<br>
<br>
=================================================================<br>
<br>
I think it may have a way to send the Disconnect Message to NAS when<br>
FreeRadius server get the Accounting-Request message. But I don't know how<br>
do I do.<br>
<br>
Appreciate for your response.<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></div></div></div></div>