I just published a gem to help manage ranges of IP numbers.

It allows you to take lots of arbitrary IP data like this;

  • 1.2.3.4
  • 1.2.1.254..1.3.4.4
  • 1.2.0.0/16

…and find out which ranges include or overlap with others. In this case, it provides output like this;

1.2.3.4 is contained by range 1.2.1.254..1.3.4.4
1.2.3.4 is contained by range 1.2.0.0/16
1.2.1.254..1.3.4.4 overlaps with 1.2.0.0/16

Here’s the source.