Oh no…. Not another CIDR calculator, because there really are a bunch.
Allow me to advocate for my app CIDRizer, focused on CIDR space coverage. If one has a CIDR block (account, VPC, etc.), and their engineers take a little slice here and there (of varying mask size and probably not consecutive), how can one actually see what’s left?
Example (CIDRizer input):
10.10.10.0/24 # Overall Account/VPC
10.10.10.32/29 # Jim's tests
10.10.10.128/29 # dev4a
10.10.10.160/28 # Ruth's team
… can be completely covered/represented as follows (CIDRizer output):
Account
CIDR | 2^(32-n) | Avail. | First | Last |
---|---|---|---|---|
10.10.10.0/24 | 256 | 254 | 10.10.10.0 | 10.10.10.255 |
Simplest Coverage CIDR Blocking (SCCB)
CIDR | 2^(32-n) | Avail. | First | Last |
---|---|---|---|---|
10.10.10.0/27 | 32 | 30 | 10.10.10.0 | 10.10.10.31 |
10.10.10.32/29 | 8 | 6 | 10.10.10.32 | 10.10.10.39 |
10.10.10.40/29 | 8 | 6 | 10.10.10.40 | 10.10.10.47 |
10.10.10.48/28 | 16 | 14 | 10.10.10.48 | 10.10.10.63 |
10.10.10.64/26 | 64 | 62 | 10.10.10.64 | 10.10.10.127 |
10.10.10.128/29 | 8 | 6 | 10.10.10.128 | 10.10.10.135 |
10.10.10.136/29 | 8 | 6 | 10.10.10.136 | 10.10.10.143 |
10.10.10.144/28 | 16 | 14 | 10.10.10.144 | 10.10.10.159 |
10.10.10.160/28 | 16 | 14 | 10.10.10.160 | 10.10.10.175 |
10.10.10.176/28 | 16 | 14 | 10.10.10.176 | 10.10.10.191 |
10.10.10.192/26 | 64 | 62 | 10.10.10.192 | 10.10.10.255 |
Algorithm & Code
I have made the repository public, with an ISC license. This unit test file details what the core algorithm is doing (and can be run via npm test
), the rest of the project’s code is simply enabling it as a NodeJS web app.
Run / Deploy
As usual npm start
, but there’s a serverless.yml
which is what I’ve used to deploy it to my domain CIDRizer.com.
That’s it. My contribution to the CIDR calculator space.