PHP IPv4 and IPv6 Network and Subnet Calculator

Just threw together a quick and dirty PHP-based subnet calculator. What sets this one apart from others is that it works with both IPv4 and IPv6 inputs and has subnet splitting capability.

Use the first field to enter a network to get details about. The format is CIDR notation ‘1.2.3.4/22’.

Use the second field to split the first network into smaller networks. The notation is ‘/24’. The network must be smaller than the 1st one obviously. Click any of the smaller subnets to show details.

http://djlab.com/stuff/ipcalc.php

Source code is on github:

https://github.com/djamps/php-ipv6-calculator

4 Responses to PHP IPv4 and IPv6 Network and Subnet Calculator

  1. Paul says:

    Please, no, PLEASE, share src of this AWESOME calc.

  2. Paul says:

    No any chance?
    Randy, please!

  3. Amit says:

    Hi Randy,

    This is exactly what I need. Could you please share the source code? Please !!!

    Thanks.
    Amit.

  4. Jay says:

    Hi all,

    Major shoutout for this script. It is really helpful. Tnx a million!
    I am implementing this script in a subnet testenvironment for Cisco students and it is working fabulous. I am having a hard time figuring out how to modify the script in order to get n-th subnet. My tool generates a random IP + CIDR and asks for exeample ‘what is the BC of the 3th subnet, given 110.11.12.15/14’
    For classful addressess I feed the question to the php class containing the script on this site as arguments and it returns an array with the answers. Now I have the n-th subnet value ready to feed to the script as an argument, but still struggling to make the answer calculation. To clarify; I still need the full set of calculations (BC, Network address, hostmin and hostmax), but this time for the n-th subnet. Can anyone plz point me in the right direction?

    Tia
    Jay