cli contributing network address suggest ๐ยถ
This page documents the contract of the cli contributing network address suggest helper and the rules contributors MUST follow when calling it.
Primary file:
Purpose ๐ฏยถ
cli contributing network address suggest proposes the next free per-role IPv4 subnet(s) based on the live role tree.
It walks every roles/*/meta/server.yml, collects occupied networks.local.subnet assignments, picks the smallest CIDR prefix that fits the requested client count, and proposes free sub-blocks gap-first then by increment within the established umbrella blocks.
Inputs ๐งยถ
Flag |
Required |
Default |
Description |
|---|---|---|---|
|
yes |
n/a |
Minimum number of usable client IPs the roleโs subnet MUST hold. |
|
no |
|
How many free subnets to return. |
|
no |
n/a |
Force suggestions inside a specific umbrella block (e.g. |
Behaviour ๐งฎยถ
Translate
--clients Nto the smallest CIDR prefix that fits (โค14 โ/28, โค30 โ/27, โค62 โ/26, โค126 โ/25, โค254 โ/24, โฆ).Walk every
roles/*/meta/server.ymland collect occupied CIDRs fromnetworks.local.subnet.Within each umbrella
/24block already in use for the chosen prefix length: enumerate all sub-blocks of that prefix length, mark occupied vs. free.Gap-first: propose the lowest unoccupied sub-block.
Increment fallback: if all sub-blocks of the active
/24blocks are used, propose the next/24block in the established sequence (currently192.168.101โ105for/28,192.168.200โ203for/24).No established sequence: if the requested prefix size has no umbrella block established yet (e.g.
--clients 1000โ/22and no/22is in use), exit non-zero with a clear error suggesting that the operator pass--block <cidr>to bootstrap a new umbrella block manually.For each suggestion, also print the client capacity (
/28 โ 14,/24 โ 254, โฆ).
Output ๐คยถ
stdout prints one subnet per line.
stderr prints per-suggestion capacity and a human-readable summary noting which umbrella block(s) were scanned.
Examples ๐กยถ
Suggest two free /28 subnets (14 clients each) inside the established umbrella blocks:
cli contributing network address suggest --clients 14 --count 2
Suggest one free /24 subnet (254 clients) bootstrapped inside an explicit umbrella block:
cli contributing network address suggest --clients 254 --block 192.168.200.0/22
Suggest a single /28 subnet (the default --count 1):
cli contributing network address suggest --clients 14
Determinism ๐งชยถ
Given the same on-disk role layout and the same arguments, the helper produces identical output. It exits non-zero with a clear error when the requested capacity cannot be satisfied within the configured umbrella block(s).
Integration with cli create role ๐งฉยถ
When cli create role scaffolds a new role, it prompts for --clients N and calls cli contributing network address suggest --clients N --count 1 to fill in meta/server.yml.networks.local.subnet automatically.
The contributor MAY override the suggestion interactively.
See port.md for the matching ports flow.