Hello All.

Here is a little script you can use to remove unused ip address from
session and index files of ip pools.

The script basically performs a radwho and a ippool -a , then compares
and eliminates the differences.

We do asume you have ippool installed and also asume radwho is working.

I hope this helps.
this script can be added to the main freeradius distribution.

As new things appear this script will be modified and probably traslated
to C.


Best Regards

Gustavo

-- 
Gustavo A. Lozano                                 Noldata Corporation
[EMAIL PROTECTED]                               Calle 46 No. 40-19
CTO                                               Bogota D.C. Colombia
Noldata Corporation                               http://noldata.com

            I know not with what weapons World War III will be fought,
               but World War IV will be fought with sticks and stones.
                                                       Albert Einstein


#!/bin/bash
# ip_clear_pool 0.9
# Bash Script to clear ippool entries in db files.
# Purpose: Free IP addresses not being used by clients but reported not available by rlm_ippool
#
# This program/script can be run from a CRONTAB, in that way you will not waste time clearing things.
# Author: Gustavo A. Lozano <[EMAIL PROTECTED]> Noldata Corp.
# 
# Released under the terms of the GNU License
#
#  
# Configurable Stuff:
# radiusdprefix: Where you installed the FreeRadius Server.

radiusdprefix=/opt/noldata/radiusd

# tmpdir: place where you can/want place temporary files
tmpdir=/tmp

#iptool: your iptool executable
iptool='/opt/noldata/radiusd/bin/iptool'

# ipsession: rlm_ippool session file
ipsession=/opt/noldata/radiusd/etc/raddb/db.pool.session

# ipindex: rlm_ippool index file
ipindex=/opt/noldata/radiusd/etc/raddb/db.pool.index

# END OF CONFIGURABLE STUFF



$radiusprefix/bin/radwho | cut -f12 -d" "| sort > $tmpdir/who
$iptool -a $ipsession $ipindex | sort > $tmpdir/ipt

for ipaddress in `sdiff  $tmpdir/who $tmpdir/ipt | grep ">" | cut -f2 -d">"`
do
  $iptool -r $ipsession $ipindex $ipaddress
  echo "Cleared $ipaddress"
done


Reply via email to