bschaatsbergen / cidr

Simplifies IPv4/IPv6 CIDR network prefix management with counting, overlap checking, explanation, and subdivision.
https://formulae.brew.sh/formula/cidr
MIT License
168 stars 9 forks source link

Add the ability to divide a CIDR range into smaller ranges #89

Closed bschaatsbergen closed 1 month ago

bschaatsbergen commented 8 months ago

The CIDR range division feature allow users to easily divide a given CIDR range into a specified number of smaller subnets.

Why: this enhancement is crucial for users dealing with IP address management, allowing them to efficiently and accurately divide CIDR ranges as needed. Improving this feature will enhance the overall usability of cidr.

Example:

Introduce a divide subcommand, where you specify both a CIDR range as well as an integer to divide it respectively.

$ cidr divide 10.0.0.0/16 9
10.0.0.0/20
10.0.16.0/20
10.0.32.0/20
10.0.48.0/20
10.0.64.0/20
10.0.80.0/20
10.0.96.0/20
10.0.112.0/20
10.0.128.0/20

h/t @steynovich for proposing this enhancement to cidr in a 1-on-1.

bschaatsbergen commented 8 months ago

What are your thoughts on this feature request @DanielRieske, @mmourick and @mvanholsteijn?

mmourick commented 7 months ago

Sounds like a very nice feature to add to cidr. I'd also like to take a crack at implementing this.

Phaze228 commented 3 months ago

Created a PR for you.