= Subnetter Brent Saner Last rendered {localdatetime} :doctype: book :docinfo: shared :data-uri: :imagesdir: images :sectlinks: :sectnums: :sectnumlevels: 7 :toc: preamble :toc2: left :idprefix: :toclevels: 7 :source-highlighter: rouge :docinfo: shared :rfc: https://datatracker.ietf.org/doc/html/rfc :arin_r: https://www.arin.net/participate/policy/nrpm/ [id="wat"] == What is it? A tool to assist in design of segregate/segment/split/subnet networks. [id="out"] == Output * `PTP` refers to "Peer-to-Peer" (e.g. {rfc}3021[RFC 3021^]). * `6rd` refers to "IPv6 Rapid Deployment", a derivation of 6to4 ({rfc}5569[RFC 5569^], {rfc}5969[RFC 5969^]). * `LIR` refers to "Local Internet Registry" ({arin_r}#2-4-local-internet-registry-lir[ARIN^]). * `RIR` refers to "Regional Internet Registry" ({arin_r}#2-2-regional-internet-registry-rir[ARIN^]). * `Unicast` refers to "Global Unicast" ({rfc}1122[RFC 1122^], {rfc}4291#section-2.5.4[RFC 4291 § 2.5.4^], {rfc}4632[RFC 4632^]). ** For IPv6 addresses, it will be `true` for ULA (_Unique Local Addresses_) ({rfc}4193[RFC 4193^]) also. ** For IPv4 addresses, it will be `true` if the address is routable by external hosts (a unicast address), including private IP addresses ({rfc}1918[RFC 1918^]). * `ILM` refers to "Interface-Local Multicast" ({rfc}4291#section-2.7[RFC 4291 § 2.7^], {rfc}7346[RFC 7346^]). ** It will always be `false` for IPv4 addresses. * `LLM` refers to "Link-Local Multicast" ({rfc}4291#section-2.7[RFC 4291 § 2.7^], {rfc}7346[RFC 7346^]). ** For IPv4 addresses, it will be `true` if it is in the `224.0.0.0/4` range ({rfc}5735[RFC 5735^]). * `LLU` refers to "Link-Local Unicast" ({rfc}4291#section-2.7[RFC 4291 § 2.7^], {rfc}7346[RFC 7346^]). ** For IPv4 addresses, it will be `true` if it is an APIPA (_Automatic Private IP Addressing_) address ({rfc}3927[RFC 3927^]) (in the `169.254.0.0/16` range). * `First` and `Last` refer 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#section-2.6.1[RFC 4291 § 2.6.1^] for details. In the interest of convenience, `subnetter` will 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[RFC 2526^]). For this reason, *if and only if* a prefix is a /64 *exactly*, `subnetter` will use `x:ffff:ffff:ffff:fffe` as 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[RFC 1918^]), ULA prefixes ({rfc}4193[RFC 4193^]), and documentation prefixes ({rfc}3849[RFC 3849^], {rfc}5737[RFC 5737^], {rfc}9637[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-reserved` is specified) if they are specified as/included in the initial prefix/network. [id="ref"] == References This program in general draws inspiration from `ipcalc` (http://jodies.de/ipcalc[0^], https://github.com/kjokjo/ipcalc[1^], https://gitlab.com/ipcalc/ipcalc[2^]) and http://www.routemeister.net/projects/sipcalc/[`sipcalc`^]. The `table` subcommand is inspired by `iptab` from https://metacpan.org/pod/Net::IP[Perl Net-IP^]. Additional notes for certain contexts are primarily taken from https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing[the Wikipedia article on _Classless Inter-Domain Routing_^] (as of _Jan 28, 2025_).