How to store IPv6-compatible address in a relational database

I’m not sure which is the right answer for MySQL given that it doesn’t yet support IPv6 address formats natively (although whilst “WL#798: MySQL IPv6 support” suggests that it was going to be in MySQL v6.0, current documentation doesn’t back that up).

However of those you’ve proposed I’d suggest going for 2 * BIGINT, but make sure they’re UNSIGNED. There’s a sort of a natural split at the /64 address boundary in IPv6 (since a /64 is the smallest netblock size) which would align nicely with that.

Leave a Comment