Radius accounting/sqlippool question
After much work, I have now upgraded my FreeRadius, HAProxy and MariaDB and appear to have a MUCH more performant system - thank you for everyone’s help and ideas. I do have a question because I think I must have missed something. In my ‘default’ I have this: post-auth { ... if(!&reply:Framed-IP-Address) { update reply { control:Pool-Name = "Pool" } sqlippool } if (noop) { reject } -sql_write ... } This allocates an address from the pool ‘Pool. In sqlippool I have this: sqlippool { sql_module_instance = "sql" dialect = "mysql" pool_name = "Pool-Name" ippool_table = "radippool" lease_duration = 3600 allocate_clear_timeout = 1 attribute_name = Framed-IP-Address req_attribute_name = Framed-IP-Address pool_key = "%{Calling-Station-Id}" messages { exists = "Existing IP: %{reply:${..attribute_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})" success = "Allocated IP: %{reply:${..attribute_name}} from %{control:${..pool_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})" clear = "Released IP %{request:${..attribute_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} user %{User-Name})" failed = "IP Allocation FAILED from %{control:${..pool_name}} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})" nopool = "No ${..pool_name} defined (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})" } $INCLUDE ${modconfdir}/sql/ippool/${dialect}/queries.conf } Also in default there is a statement that I should uncomment sqlippool in the accounting section: accounting { detail # # Return an address to the IP Pool when we see a stop record. # # Ensure that &control:Pool-Name is set to determine which # pool of IPs are used. # sqlippool -sql_write exec attr_filter.accounting_response } I’m getting a bit confused here. I can see that ‘control:Pool-Name’ works for authentication because addresses are being allocated from that pool But do I need to uncomment sqlippool and then how to I tell it to use the pool name ‘Pool’? Is pool_name=‘Pool-Name’ referencing the Pool-Name above or is that the actual name of the pool it will use? Thanks David
David Lake via Freeradius-Users <freeradius-users@lists.freeradius.org> writes:
$INCLUDE ${modconfdir}/sql/ippool/${dialect}/queries.conf
Take a look at that file. The SQL queries shows what the sqlippool module does in different phases.
I’m getting a bit confused here. I can see that ‘control:Pool-Name’ works for authentication because addresses are being allocated from that pool
But do I need to uncomment sqlippool and then how to I tell it to use the pool name ‘Pool’? Is pool_name=‘Pool-Name’ referencing the Pool-Name above or is that the actual name of the pool it will use?
You need to do that both to extend the "lease" on acct updates and to release the address on stop. The pool name is irrelevant for accounting, assuming the default SQL queries are used. The entries are looked up by attributes from the accounting packet. Bjørn
I can (mostly) see what I ned to do here but I have more questions (sorry!). In post-auth, I am making these changes: * Acct-Interim-Interval := 1800 * Session-Timeout :=7200 In sqlippool I have this: lease_duration = 7200 One piece I don’t understand. In post-auth, at the moment I have this: if (session-state:User-Name && reply:User-Name && request:User-Name && (reply:User-Name == request:User-Name)) { update reply { &User-Name !* ANY } } update { &reply: += &session-state: } if(!&reply:Framed-IP-Address) { update reply { control:Pool-Name = "Pool" } sqlippool } if (noop) { reject } # # Refresh leases when we see a start or alive. Return an address to # the IP Pool when we see a stop record. # # Ensure that &control:Pool-Name is set to determine which # pool of IPs are used. # sqlippool My question is, do I need BOTH the sqlippool statements or just one? The idea of the first was to allocate from the pool named ‘Pool’ if no Framed-IP-Address is set and then update the sqlippool. What else needs to change? Thanks David From: Bjørn Mork <bjorn@mork.no> Date: Thursday, 8 October 2026 at 18:34 To: David Lake via Freeradius-Users <freeradius-users@lists.freeradius.org> Cc: Lake, David Dr (FEPS Faculty Admin) <d.lake@surrey.ac.uk> Subject: Re: Radius accounting/sqlippool question David Lake via Freeradius-Users <freeradius-users@lists.freeradius.org> writes:
$INCLUDE ${modconfdir}/sql/ippool/${dialect}/queries.conf
Take a look at that file. The SQL queries shows what the sqlippool module does in different phases.
I’m getting a bit confused here. I can see that ‘control:Pool-Name’ works for authentication because addresses are being allocated from that pool
But do I need to uncomment sqlippool and then how to I tell it to use the pool name ‘Pool’? Is pool_name=‘Pool-Name’ referencing the Pool-Name above or is that the actual name of the pool it will use?
You need to do that both to extend the "lease" on acct updates and to release the address on stop. The pool name is irrelevant for accounting, assuming the default SQL queries are used. The entries are looked up by attributes from the accounting packet. Bjørn
participants (2)
-
Bjørn Mork -
David Lake