List:General Discussion« Previous MessageNext Message »
From:Aaron Conaway Date:February 11 2003 6:15pm
Subject:IP Addresses -- How to Store
View as plain text  
I'm looking to develop a database of IP addresses for the company and
have, of course, chosen mySQL as the backend.  I want the app to add
(remove, etc.) a host, giving its hostname and segment.  The app will
add the next available address to the database and, looking at the
segment, provide the subnet mask and default gateway for said new host.
I've got the db structure written out, but I'm having issues on how to
store the data like address, subnet mask, default gateway.

Our network is very diverse, covering many ranges of addresses and, more
importantly, many subnet masks.  Some are 24bit, some are 16bit, and
some are 23bit.  What is the best way to store this data in mySQL?

If I do a varchar, then how do I restrict the data to between 0 and 255?
Also, how would I manipulate any address with a classless mask?  I'm
thinking storage as binary so I can parse out a byte of binary data and
present it as a decimal number; this also limits the data to numbers
between 0 and 255, based on an 8-bit byte.  The problem is that I have
no clue how to store such.

I'm running around in circles on this one.  Can some point me to a
resource that can shed some light on this type of data storage?

---------- 
Aaron Conaway 
Network Engineer III 
Verisign, Inc. -- Telecom Services Division 
http://www.verisign.com 
Office:  912.527.4343 
Fax:  912.527.4014 
Thread
IP Addresses -- How to StoreAaron Conaway11 Feb
  • Re: IP Addresses -- How to StoreDan Nelson11 Feb
    • Re: IP Addresses -- How to StorePeter Hicks11 Feb
  • Re: IP Addresses -- How to StoreMichael T. Babcock11 Feb
  • Re: IP Addresses -- How to StorePeter Grigor11 Feb
    • Re: IP Addresses -- How to StoreMichael T. Babcock11 Feb
RE: IP Addresses -- How to StoreAaron Conaway11 Feb