----- Original Message ----- From: "Michael T. Babcock" <[EMAIL PROTECTED]> To: "Aaron Conaway" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, February 11, 2003 3:25 PM Subject: Re: IP Addresses -- How to Store
> On Tue, Feb 11, 2003 at 01:15:01PM -0500, Aaron Conaway wrote: > > 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. > > Consider familiarizing yourself with bit-level network masking > math and then store your IP addresses as 16 bit long integer > values (until you're storing ipv6 addresses, of course). Store > your network mask as either the 16 bit value of the mask or if > you care about space, a tinyint of how many bits are in the mask. Dood, he's not gonna be very happy storing an IP as 16 bits :) --------------------------------------------- Peter Grigor Hoobly Classified Ads http://www.hoobly.com --------------------------------------------------------------------- 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