Next Pool option

Fajar A. Nugraha list at fajar.net
Tue Jul 5 11:25:00 CEST 2011


On Tue, Jul 5, 2011 at 3:35 PM, Antonio Maciá <amacia at sedesc.es> wrote:
> Hi!
>
>
>
>             I’m running the 2.1.11 version and I would like to know how to
> configure next-pool options in the ippool file in order to get a ip from a
> secondary pool when the first pool is starved.
>
> Let’s say I have two pools, 172.16.1.0/24 and 192.168.10.0/24 and I want
> that as soon as the 172.16.1.0 range is empty, the Radius start giving
> addresses form the 192.168.10.0 pool. Is it possible?

Unlang is your friend.

The key point is when a pool exhaust its ip address range, it will
return notfound. So you can have something like this in
modues/ippool-test:

ippool ippool-test1 {
	range-start = 192.168.1.1
	range-stop = 192.168.1.254
	netmask = 255.255.255.0
	cache-size = 256
	session-db = ${db_dir}/db.ippool-test1
	ip-index = ${db_dir}/db.ipindex-test1
	override = no
	maximum-timeout = 0
}
ippool ippool-test2 {
	range-start = 192.168.2.1
	range-stop = 192.168.2.254
	netmask = 255.255.255.0
	cache-size = 256
	session-db = ${db_dir}/db.ippool-test2
	ip-index = ${db_dir}/db.ipindex-test2
	override = no
	maximum-timeout = 0
}

... and something like this on users (or db, wherever your users data is)

testuser  Cleartext-Password := "testpass", Pool-Name := "redundant-pool"

... and something this in post-auth

        if ("%{control:Pool-Name}" == "redundant-pool") {
                update control {
                        Pool-Name := "ippool-test1"
                }
                ippool-test1
                if (notfound) {
                        update control {
                                Pool-Name := "ippool-test2"
                        }
                        ippool-test2
                }
        }

-- 
Fajar




More information about the Freeradius-Users mailing list