How to store IPV6 as bigint?

i want to

  1. store ipv6 as bigint
    2.check how many ip's between 2 ipv6 (after section 1)

thanks

IPv6 is a 128 bit address, bigint is a 64 bit integer representation. You won't be able to properly store it even with some kind of compression or interpolation unless you use 2 bigint columns. You could however using binary(16).

1 Like

What is the length of your ipv6. and can you post a sample if you are able to. are you looking for some gaps?

2001:0db8:85a3:0000:0000:8a2e:0370:7334

yes.

@robert_volk - how do i convert them to and from binary? and how do i calculate gaps between them?