How to make primary key an IP address?

G

Gary

Hello all,
Does anyone know how you would make the primary key and IP address? A
dotted decimal address like 10.0.0.1?
TIA,
Gary
 
K

Ken Snell

Set the format of the field to text, and then select the field as the
primary key.
 
H

HSalim

If you must use an IPAddress as a primary key then I would strongly
recommend that you split it into 4 numeric fields with a Byte datatype. You
will have to use a compisite unique index, combining the 4 columns.

Further you should add appropriate constraints to different columns to
ensure that you have valid IPs
Here is a partial list for you:
- Loopback address range 127.xxx.xxx.xxx should be excluded
- 0.0.0.0 (default IP) and 255.255.255.255 and (Broadcast) should be
excluded
- Class D & E addresses should be Excluded (right?)
- What about Private IP addresss ranges (RFC1918) Include? Exclude?
- 10.xxx.xxx.xxx, 172.16.xxx.xxx to 172.31.xxx.xxx, 192.168.xxx.xxx?

I can almost bet that this is an internal project and you want to address
private IP address ranges only.
Are you planning to forgo DHCP and use static IP addresses or Address
reservations for everything?
If external IP addresses, how do you plan to account for IP address changes
in a world that predominantly uses dynamic IP addresses?

What happens when IPv6 kicks in? Yes, the IPv4 address is embedded in the
IPv6 address, but shouldn't you expect duplication as time goes on?

IP addresses are not good candidates for primary keys in most circumstances,
so please consider carefully before proceeding.

HS
 
G

Gary

Hello,
We want to stay with DHCP. We are trying to create an access database
based on IP address so we can search and sort our internal IP's.
TIA,
Gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top