FreeRADIUS WikiMain Page | About | Help | FAQ | Special pages | Log in

Printable version | Disclaimers | Privacy policy

Rlm sqlhpwippool

From FreeRADIUS Wiki

Robust dynamic IPv4 pools for FreeRADIUS Server allowing arbitrary groups of Network Access Servers to share IP address blocks in an efficient and flexible manner.

Contents

Features

This module implements dynamic IPv4 address pools with the following features:

For this purpose, it integrates with an external project called netvim (which is going to be started soon). However, the module can be used separately.

Data structures

The module uses following netvim SQL tables:

Also, the module has it's very own tables as well:

The MySQL database schema

The algorithm

Startup

Post-authentication

Accounting

Configuration

Limitations

PHP script to generate code to insert new IP addresses

This script generates MySQL queries to update the ips table after making changes in ip_pools table. You should run the queries each time you add IP pools.

#!/usr/bin/env php
<?php
error_reporting(E_ALL);

mysql_connect("localhost", "root", "password");
mysql_select_db("netvim");

$rows = mysql_query("select ip_start, ip_stop from ip_pools");

while ($row = mysql_fetch_assoc($rows)) {
        $todo = $row["ip_stop"] - $row["ip_start"] + 1;
        $done = 0;
        $ineach = 100;
        $startwith = $row["ip_start"];

        echo "LOCK TABLES ips WRITE;\n";
        while ($done < $todo) {
                echo "REPLACE INTO ips (ip) VALUES ";
                for ($i = 1; $i < $ineach && $done < $todo; $i++, $startwith++, $done++) {
                        echo "($startwith), ";
                }
                echo "($startwith);\n";
                $startwith++; $done++;
        }
        echo "UNLOCK TABLES;\n";
}
?>

See Also

Retrieved from "http://wiki.freeradius.org/Rlm_sqlhpwippool"

This page has been accessed 3,700 times. This page was last modified on 26 February 2007, at 21:15.


Find

Browse
Main Page
Community portal
Current events
Recent changes
Random page
Help
Edit
View source
Editing help
This page
Discuss this page
New section
Printable version
Context
Page history
What links here
Related changes
My pages
Log in / create account
Special pages
New pages
File list
Statistics
More…