Subnetter
1. What is it?
A tool to assist in design of segregate/segment/split/subnet networks.
2. Output
-
PTPrefers to "Peer-to-Peer" (e.g. RFC 3021). -
6rdrefers to "IPv6 Rapid Deployment", a derivation of 6to4 (RFC 5569, RFC 5969). -
LIRrefers to "Local Internet Registry" (ARIN). -
RIRrefers to "Regional Internet Registry" (ARIN). -
Unicastrefers to "Global Unicast" (RFC 1122, RFC 4291 § 2.5.4, RFC 4632). -
ILMrefers to "Interface-Local Multicast" (RFC 4291 § 2.7, RFC 7346).-
It will always be
falsefor IPv4 addresses.
-
-
LLMrefers to "Link-Local Multicast" (RFC 4291 § 2.7, RFC 7346).-
For IPv4 addresses, it will be
trueif it is in the224.0.0.0/4range (RFC 5735).
-
-
LLUrefers to "Link-Local Unicast" (RFC 4291 § 2.7, RFC 7346).-
For IPv4 addresses, it will be
trueif it is an APIPA (Automatic Private IP Addressing) address (RFC 3927) (in the169.254.0.0/16range).
-
-
FirstandLastrefer to the first and last "usable" ("host"/assignable) addresses in a subnet/network.-
Note that for IPv6, the first address (
x::) in a subnet may or may not be assignable/"usable". If it is assigned to a device, that device must be a router for anycast. See RFC 4291 § 2.6.1 for details. In the interest of convenience,subnetterwill report this address as not usable/addressable in ranges for this reason as it is technically not a "host" address. -
Note that for IPv6, some subnetting calculators erroneously report the last address for /64’s (e.g.
x:ffff:ffff:ffff:ffff/64) as usable. They are actually reserved in strictly RFC-compliant networks for EUI-64 reasons (per RFC 2526). For this reason, if and only if a prefix is a /64 exactly,subnetterwill usex:ffff:ffff:ffff:fffeas the last host address. -
There are additional restrictions for /64 subnets, but they fall earlier in the range. These are not explicitly excluded in the usable host range, nor are they excluded from the total host count.
-
-
Private networks (RFC 1918), ULA prefixes (RFC 4193), and documentation prefixes (RFC 3849, RFC 5737, RFC 9637) are treated as "normal" networks (in that it is allowed to subnet them).
-
Various other reserved IPv4 and IPv6 addresses/networks will print warnings with their corresponding RFC(s) (unless
-R/--allow-reservedis specified) if they are specified as/included in the initial prefix/network. (RFC 6890 and its update via RFC 8190 are useful summaries.) Note that for checking to function, an Internet connection is required as it pulls it directly from IANA live to ensure the data is accurate to standards. This may be cached locally if-c/--cache-reservationsis specified, in which case a locally-cached copy will be used if present and populated then used if not.-
The cache directory may be specified by
-C/--cache-dir(which can be specifically defaulted via theSBNTR_RSVCACHE_DIRenvironment variable). If it is not specified, the default (see below) will be used. -
This directory’s default location determined by the following, and will be created if it doesn’t exist:
-
For non-Windows systems (macOS, Linux, etc.)…
-
If the
XDG_CACHE_HOMEenvironment variable is present, it will be${XDG_CACHE_HOME}/subnetter/. (If XDG base dirs are enabled, this is usually~/.cache/subnetter/or, explicitly,/home/<username>/.cache/subnetter/) -
If the
XDG_CACHE_HOMEenvironment variable is not present…-
On macOS, an explicit fallback of
~/Library/Caches/subnetter/will be used. (To my knowledge/understanding, this is the standard user cache directory and cannot be changed.) This usually evaluates to/Users/<username>/Library/Caches/subnetter/. -
On all others, an explicit fallback of
~/.cache/subnetterwill be used.-
On most non-macOS \*NIX-like systems , this is usually
/home/<username>/.cache/subetter/, provided normal user homes. On Plan9 platforms (e.g. Plan 9 4th Ed., 9front, 9legacy), the/env/homeenvironment variable ($home) will be used, the./lib/subdirectory under there (which typically/should already exist) will be appended to it, and that appended with./cache/subnetter/(this usually evaluates to/usr/<username>/lib/cache/subnetter/).
-
-
-
-
For Windows systems…
-
If the
LOCALAPPDATAenvironment variable is present, it will be%LOCALAPPDATA%\Cache\subnetter\(or${env:LOCALAPPDATA}\Cache\subnetter\in Powershell syntax). This usually evaluates toC:\Users\<username>\AppData\Local\Cache\subnetter\.
-
-
-
3. References
The table subcommand is inspired by iptab from Perl Net-IP.
Additional notes for certain contexts are primarily taken from the Wikipedia article on Classless Inter-Domain Routing (as of Jan 28, 2025).