Is there a way to store the IP number in a numeric format in the database?
Well, of course you can convert each hexadecimal fragment of an IPv6 address into a numeric (integer) value and store 8 (or more) integers in the database, but
this will not make any sense for various reasons.
--
Excerpt from wikipedia:
An IPv6 address is represented as eight groups of four hexadecimal digits, each group representing 16 bits (two octets, a group sometimes also called a hextet[6][7]). The groups are separated by colons (:). An example of an IPv6 address is:
Code: Select all
2001:0db8:85a3:0000:0000:8a2e:0370:7334
--
Obviously, 8 (or more) integers, converted from hex (IPv6), can never be stored in 4 bytes (IPv4)
without data loss. It is like putting a trillion big elephants into 4 too small dog-houses.
So that on the page the field is displayed as e.g. 192.168.0.1 ?
No, you cannot convert every possible IPv6 addresses into a 4-byte-IPv4 representation
without data loss.
The major reason why IPv6 was invented years ago was that IPv4 range is much too small for all publicly addressable devices in the world today. There may be hacks for looking up matching IPv4 addresses within a Local Area Network but this will probably never work for addresses outside a given subnet.
So, we all have to get used to the fact that an IP address no longer looks like it did in the 1990s
IPv6
is a valid IP address representation.
If you want to store the IP-address, just store the IP address
PS: There is no place like 127.0.0.1 