Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine


by Clownburner (Monk)
on Mar 27, 2001 at 20:39 UTC ( #67533=modulereview: print w/replies, xml ) Need Help??

Item Description: Manipulates IP addresses, masks, and subnets

Review Synopsis:

NetAddr::IP provides a simple interface to the tedious bit manipulation involved when handling IP address calculations. It also helps by performing range comparisons between subnets as well as other frequently used functions such as:

  • Checks to see if a host address or subnet is contained within another subnet
  • Count number of host addresses in a subnet
  • Enumeration of host addresses in a subnet
  • Calculate the Subnet or broadcast address of a given IP address and mask
  • Validation of host or subnet addresses
  • Compact subnets or addresses into the largest possible CIDR block
It can also return results in either CIDR notation ( or regular Mask notation ( You can also return addresses without masks, or masks without addresses.

Who should use it?

Anyone who needs to perform complex operations on IP addresses, such as determining a subnet address for a given address, or a quick way to determine if address/subnet A is in subnet B. Saves a lot of time with binary conversions.

Who should NOT use it?

Anyone who is running on a system that may have endian problems -- the author clearly states in the documentation that it has not been extensively tested on a range of platforms. Be careful.


Complete and very well presented, with plenty of examples.

Personal Notes

I've used this module extensively for subnet determination and address manipulation, and it worked extremely well (at least on Linux/Intel, there were no endian problems). The documentation is clear and simple. Recommended!

Replies are listed 'Best First'.
Re: NetAddr::IP
by fokat (Deacon) on Nov 08, 2002 at 04:46 UTC
    Thanks a lot for the positive review. Just to add a few points:

    • Additional formats supported:

      • "Range" notation such as in for 10.10.10/24

      • Cisco's wildcard notation

      • inet_aton and inet_ntoa to feed directly to old-style socket calls

    • The code has been tested in the following platforms by the author: Solaris/Sparc, Linux/Intel, FreeBSD/Intel, Win32/Intel, Digital Unix/Alpha, HP-UX/PA-RISC, Mac OS X/PPC. No reports of endianness-related problems have been received so far.

    If you're running a version earlier than 3.00, please do consider upgrading. 3.xx includes vast performance improvements in many operations as well as a simpler internal representation guaranteed to be portable to any machine with 32 bits integers.

    Best regards

    -lem, but some call me fokat

    Update: I mistakenly mentioned 3.20 before it came into existence. Current versions as of this writing are 3.14 (production) and 3.14_1 (development, with fresh patches for IPv6).

      Thanks. Out of curiosity, where do you get 3.20? The newest version in CPAN seems to be 3.14.
      "Non sequitur. Your facts are un-coordinated." - Nomad
        My mistake. 3.14 and 3.14_1 are the latest versions. The latest version will always be at CPAN.

        Best regards

        -lem, but some call me fokat

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: modulereview [id://67533]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2023-03-30 14:31 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (74 votes). Check out past polls.