The Next Available Subnet finder calculates free address space by subtracting existing allocations from available pools, then identifying appropriately-sized gaps that can accommodate the requested subnet size.
Allocation Strategies:
- First-fit: Returns the first available subnet that meets the size requirement. Fastest, good for sequential allocation patterns.
- Best-fit: Returns subnets from the smallest available gap that can fit the request. Minimizes fragmentation and waste.
Example - First Fit:
- Pool: 192.168.1.0/24
- Allocated: 192.168.1.0/26, 192.168.1.64/26
- Request: /26 (64 addresses)
- Result: 192.168.1.128/26 (first available /26 in gaps)
Example - Best Fit:
- Pool: 10.0.0.0/22 with various allocations creating gaps of sizes /26, /25, /24
- Request: /26
- Result: Subnet from the /26 gap (perfect fit, no waste)
Prefix vs. Host Count:
You can specify subnet size in two ways:
- Desired Prefix: Directly specify /24, /26, /64, etc.
- Host Count: Specify number of hosts needed (e.g., 50). Tool calculates required prefix automatically.
IPv4 Usable Hosts:
When enabled for IPv4, the tool accounts for network and broadcast addresses:
- Request 50 usable hosts → Requires /26 (64 total, 62 usable)
- Request 62 usable hosts → Requires /25 (128 total, 126 usable)
Algorithm Steps:
- Parse and validate all pools and allocations
- Calculate gaps within each pool by subtracting allocations
- Determine required prefix length based on host count or specified prefix
- Search gaps using selected strategy (first-fit or best-fit)
- Return up to Max candidates with metadata (parent pool, size, usable hosts)
Performance and Scalability:
The tool efficiently handles large pools and many allocations by using optimized data structures. For extremely large IPv6 pools, best-fit may take longer than first-fit but provides better utilization.