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 --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php