acct_unique module - Dynamic Client-IP-Address causes duplicate session entries in accounting table
My set up: multiple servers with FreeRadius 1.1.0, MySQL 5.0.27 with Master-Master replication After some trouble with duplicate entries in the radius accounting table due to non-unique Acct-Session-Id's, I switched to using the acct_unique module. acct_unique { key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address, NAS-Port" } This works fine as long as the Client-IP-Address remains a constant during a session. But when the connection to the ISP drops for a moment, a new Client-IP-Address will be used and the Acct-Unique-Session-Id will change in the middle of a session. This causes a new session to be inserted into the accounting table. The new session simply continues using all the values of the previous session as the NAS is not aware of the Client-IP-Address change. This will cause that the time of the first session and the second session are added, even it is the same session. This is pretty bad for prepaid tickets as their life is shortend. I like to change the acct_unique set up and exchange the Client-IP-Address with another more steady parameter like NAS-Identifier or Called-Station-Id or Calling-Station-Id or Framed-IP-Address. I am going to use the following: acct_unique { key = "User-Name, Acct-Session-Id, NAS-IP-Address, Calling-Station-Id, NAS-Port" } The Calling-Station-Id (end-user MAC address) would not change during a session and is not really user selectable. While the Called-Station-Id and NAS-Identifier could occur multiple times as this might be a configurable NAS parameter. Any recommendations on this?
"Gunther" <freeradius@caribsms.com> wrote:
But when the connection to the ISP drops for a moment, a new Client-IP-Address will be used and the Acct-Unique-Session-Id will change in the middle of a session.
You're saying a users session stays up even if the NAS goes down? I haven't heard that before.
Any recommendations on this?
It looks like it would work, but why is the Client-IP-Address changing? Alan DeKok. -- http://deployingradius.com - The web site of the book http://deployingradius.com/blog/ - The blog
Alan DeKok wrote:
"Gunther" <freeradius@caribsms.com> wrote:
But when the connection to the ISP drops for a moment, a new Client-IP-Address will be used and the Acct-Unique-Session-Id will change in the middle of a session.
You're saying a users session stays up even if the NAS goes down? I haven't heard that before.
No, the NAS does not go down, just either the router to the ISP or the ISP, causing a new IP address in a ISP DHCP environment
Any recommendations on this?
It looks like it would work, but why is the Client-IP-Address changing?
Yes, for the last 12 hours it works well. The Client-IP-Address changes when the connection to the ISP is down for whatever reason. Here two packets were the ISP connection was down for 30 minutes (a moment), while the NAS was up and running, keeping the session alive. With the use of Calling-Station-Id instead of Client-IP-Address for acct_unique, the existing accounting table entry will be used instead of adding another entry for the same session (Acct-Unique-Session-Id remains the same!): Sat Nov 18 12:18:10 2006 Acct-Status-Type = Interim-Update User-Name = "MyUsername" Calling-Station-Id = "00-0D-88-00-xx-B9" Called-Station-Id = "00-16-B6-1C-xx-32" NAS-Port-Type = Wireless-802.11 NAS-Port = 8 NAS-Port-Id = "00000008" NAS-IP-Address = 0.0.0.0 NAS-Identifier = "00-16-B6-1C-xx-34" Framed-IP-Address = 192.168.182.5 Acct-Session-Id = "455e3b1a00000008" Acct-Input-Octets = 213280 Acct-Output-Octets = 213280 Acct-Input-Gigawords = 0 Acct-Output-Gigawords = 0 Acct-Input-Packets = 2666 Acct-Output-Packets = 2666 Acct-Session-Time = 48859 Client-IP-Address = xx.yy.80.129 Acct-Unique-Session-Id = "36857b8cc9e1608f" Timestamp = 1163852290 Sat Nov 18 12:48:40 2006 Acct-Status-Type = Interim-Update User-Name = "MyUsername" Calling-Station-Id = "00-0D-88-00-xx-B9" Called-Station-Id = "00-16-B6-1C-xx-32" NAS-Port-Type = Wireless-802.11 NAS-Port = 8 NAS-Port-Id = "00000008" NAS-IP-Address = 0.0.0.0 NAS-Identifier = "00-16-B6-1C-xx-34" Framed-IP-Address = 192.168.182.5 Acct-Session-Id = "455e3b1a00000008" Acct-Input-Octets = 221200 Acct-Output-Octets = 221200 Acct-Input-Gigawords = 0 Acct-Output-Gigawords = 0 Acct-Input-Packets = 2765 Acct-Output-Packets = 2765 Acct-Session-Time = 50689 Client-IP-Address = xx.yy.22.61 <-- New IP Address Acct-Unique-Session-Id = "36857b8cc9e1608f" <-- Same unique Id Timestamp = 1163854120
participants (2)
-
Alan DeKok -
Gunther