For whatever it's worth, some years ago I wrote a database that kept track
of IPs.  I found it very easy if I treated the IPs as numbers.

Each IP is a quartet of digits, each in the range 0-255.  This really means
an IP is a 4-digit number in base 256 and you can use use standard
conversion functions from base 256 to base 10 and back (although these are
bigints).  So range checking is easy: convert the range limits and the
search IP to integers base-10, and do a normal compare.

I found dealing with IPs any other way far too cumbersome.

Jim

On Thu, Jun 12, 2008 at 8:24 AM, Scusting <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I need to be able to store data from our Radius servers that includes IP
> addressing and IP blocks into a MySQL field that is easily searchable.
>
> Basic IP addreses I have sorted with INET_ATON(), but is there a way to
> store blocks of IP's as in "192.168.1.0/24" in a way that would allow it
> to be found in a search for say 192.168.1.100?  Perhaps a method to take
> the block and insert the 1st and last IP's into seperate columns so I can
> check to see if it falls between these 2 values?
>
> The import of Radius into MySQL is performed by doing a 'LOAD DATA LOCAL
> INFILE' on a CSV file.  Ideal would be a solution to insert the 1st and last
> IP address based on the IP block at the time of doing the LOAD?
>
> Thanks.
> Jim.
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>


-- 
Jim Lyons
Web developer / Database administrator
http://www.weblyons.com

Reply via email to