Using Javascript (without JQuery) I'm looking to get the minimum and maximum IPs in a IPv6 CIDR prefix.
For example, 2001:280::/32
would output 2001:280:0:0:0:0:0:0
and 2001:280:ffff:ffff:ffff:ffff:ffff:ffff
.
How can I do this? Thanks in advance!
Try the
ip6
npm package: https://www.npmjs.com/package/ip6ip6
helps to normalize, abbreviate, divide subnets, generate random subnets/hosts and calculate range of size of an IPv6 subnet.Or in command line:
Assuming you have Node and NPM installed:
There doesn't seem to be a browser facing package so I'd suggest using Browserify (http://browserify.org/) to get this to work or fork the project and stuff everything into one file so you can run it in your browser (leaving out the node-specific code, of course).