For those working with sqlippool, I made a quick script which will make
it easy for you to create the ip blocks in the radippool table.  Might
be nice for new users if this was included in the scripts directory.

 

#!/bin/sh

 

# This script will output the necessary INSERT commands

# for the sqlippool module in freeradius

 

# Enter the pool name attribute

POOL_NAME=your_pool_name

 

# Set the first 2 octets of the IP network

NETWORK=1.1

 

# Set the starting point of the third octet

START_RANGE=1

 

# Set the ending point of the third octet

END_RANGE=254

 

# Set the starting point of the fourth octet

MIN_IP=1

 

# Set the ending point of the fourth octet

MAX_IP=254

 

########################################################################
#

########################################################################
#

 

# Make sure that END_RANGE is higher than START_RANGE

if [ $START_RANGE -gt $END_RANGE ] ; then

   echo "ERROR: Then ending range must be higher than the starting
range."

   exit 1

fi

 

SUBNET=$START_RANGE

IP=$MIN_IP

count=0

 

while [ true ]; do

   if [ $IP -gt $MAX_IP ] ; then

        if [ $SUBNET -eq $END_RANGE ] ; then

           exit 0;

        else

           SUBNET=$(( $SUBNET + 1 ))

           IP=$MIN_IP

        fi

   fi

 

   echo "INSERT INTO radippool (pool_name, FramedIPAddress) VALUES
('$POOL_NAME', '$NETWORK.$SUBNET.$IP');"

 

   IP=$(( $IP + 1 ))

done;

 

exit 0

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to