-1

I found many information how to get all addresses from ipv4 cidr subnet, but nothing helpful for ipv6.

Have php any libaries to calculate that? What i need is an array of all addresses from a ipv6 cidr subnet.

For example all addresses from this subnet 3FFA:FF2B:4D:A000::/51.

After that i want to do an nslookup on this addresses.

mk2015
  • 205
  • 2
  • 14

1 Answers1

4

What i need is an array of all addresses from a ipv6 cidr

Actually, that probably isn't what you want. The numbers of addresses involved can quickly grow to be unmanageable. Holding them all in an array is going to require a huge amount of memory. (e.g. if you hold each address as a 128bit value then for a /51 you would need around 2,000,000,000,000 TB of ram to hold that array).

What you really want is probably something that will generate the sequential addresses so that you can iterate over the addresses and perform some action on each; again this is not likely to be managable, as even if you are only taking 1ns to process each IP you are going to take millenia to actually iterate over all the addresses in a /51 (e.g. (1e-9 * 2**77)/(86400*365) = 4,791,848 years).

Russell Heilling
  • 1,829
  • 1
  • 12
  • 10