Skip to content
Random local IPv4/IPv6 ULA subnet generator
C Nix Meson
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
COPYING
README.md
default.nix
getentropy_windows.h
logo.svg
meson.build
pkgs.nix
subnetgen.c

README.md

subnetgen

Tool to generate IPv4 and IPv6 subnetworks.

Rationale is to make sure networks are composable, allowing to use more than one network while keeping every peer addressable.

IPv6 subnetworks are RFC 4193 ULA conformant.

Randomness is taken from getentropy(3). At the moment of writing, this API is only natively supported in Fuchsia, Linux and OpenBSD. Compatiblity shim is provided for Windows.

Network Flag N, 50% collision chance Network capacity
IPv4 -4 300 254
IPv6 -6 1 230 000 more than septillion

As you can see, generated IPv4 networks provide very limited capacity. You can trade some uniqueness for more peers by decrementing CIDR prefix: refer to CIDR.xyz.

Flags are processed in order and can be repeated. For example, subnetgen -44664 will print two IPv4 subnets, then two IPv6 subnets, and then one more IPv4 subnet, in that order, each on separate line.

If you want to calculate chance of collision, refer to birthday problem.

You can’t perform that action at this time.