1

Does anyone know of a tool or utility that can be used to quickly find out if an IPv6 prefix falls within a certain range?

For instance given the input prefix range of fe80-febf and the input prefix of fe79 it would return true to indicate that the latter argument is within the former.

Or another example might be given the input prefix range of fe80-febf and the input prefix of fe81 it would return false to indicate that the latter argument would be outside the range specified in the former.

leeand00
  • 4,869
  • 15
  • 69
  • 110

2 Answers2

2

I'd break out the python, personally.

>>> x = 'fe79'
>>> int('fe80', 16) <= int(x, 16) <= int('febf', 16)
False
>>> x = 'fe81'
>>> int('fe80', 16) <= int(x, 16) <= int('febf', 16)
True
Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • Hmm if there was a way to do this in Javascript I think it would be easiest since most people have that lying around...I'll bet there's a way to do that...looking further into this... – leeand00 Oct 28 '11 at 16:33
  • I suppose I could just throw it into codepad.org too... – leeand00 Oct 28 '11 at 16:44
  • Okay here's a url to the codepad.org of your suggestion: http://bit.ly/uXU53j Thanks! – leeand00 Oct 28 '11 at 16:52
1

Fully expanding the address to the 39 character string representation and then using string comparison?

Not the fastest but maybe the easiest

Sander Steffann
  • 7,712
  • 19
  • 29