basforge

Search titles, text and the “If it doesn’t work” cases.

    RU
    Cheat sheetLinuxNetworking

    CIDR masks and reserved IP ranges

    IPv4 prefixes from /32 to /8 with netmasks, block steps, and usable host counts, every reserved IPv4 and IPv6 range, and quick terminal commands for subnet math.

    IPv4 subnet calculator

    Type any address with a prefix or pick a preset — network boundaries, broadcast, netmask, and the 32-bit octet layout update immediately (see IPv4, masks, and CIDR for how the math works):

    32 address bits · blue — network part, grey — host partMask: 255.255.255.192 (/26)
    192octet 1
    11000000
    168octet 2
    10101000
    10octet 3
    00001010
    42octet 4
    00101010
    Network address192.168.10.0/26
    Hosts192.168.10.1 – 192.168.10.62
    Broadcast192.168.10.63
    Addresses / hosts64 / 62

    IPv4 masks: last octet (/32 – /24)

    The boundary falls inside the fourth octet; the block step equals 256 − last mask octet.

    Prefix Netmask Block step Total addresses Usable hosts Where it appears
    /32 255.255.255.255 1 1 1 Single host, firewall rule, host route
    /31 255.255.255.254 2 2 2 Point-to-point router link without broadcast (RFC 3021)
    /30 255.255.255.252 4 4 2 Classic point-to-point link (network + 2 hosts + broadcast)
    /29 255.255.255.248 8 8 6 Small block of public IPv4 addresses from a host
    /28 255.255.255.240 16 16 14 Small subnet, DMZ, management segment
    /27 255.255.255.224 32 32 30 Dedicated VLAN for servers or management
    /26 255.255.255.192 64 64 62 Quarter of a /24: .0, .64, .128, .192 blocks
    /25 255.255.255.128 128 128 126 Half of a /24: .0–.127 and .128–.255 blocks
    /24 255.255.255.0 1 (3rd octet) 256 254 Standard LAN, VLAN, home router

    IPv4 masks: larger networks (/23 – /8)

    Prefix Netmask Step (octet) Total addresses Usable hosts Where it appears
    /23 255.255.254.0 2 (3rd) 512 510 Two adjacent /24s in a large office or guest Wi-Fi
    /22 255.255.252.0 4 (3rd) 1,024 1,022 Four /24s
    /21 255.255.248.0 8 (3rd) 2,048 2,046 Eight /24s
    /20 255.255.240.0 16 (3rd) 4,096 4,094 Default Docker pools after the 15th network (192.168.0.0/20)
    /19 255.255.224.0 32 (3rd) 8,192 8,190 Thirty-two /24s
    /18 255.255.192.0 64 (3rd) 16,384 16,382 Quarter of a /16
    /17 255.255.128.0 128 (3rd) 32,768 32,766 Half of a /16
    /16 255.255.0.0 1 (2nd) 65,536 65,534 Docker networks (172.17.0.0/16), private 192.168.0.0/16 block
    /12 255.240.0.0 16 (2nd) 1,048,576 1,048,574 Private 172.16.0.0/12 block (172.16–172.31)
    /10 255.192.0.0 64 (2nd) 4,194,304 4,194,302 ISP CGNAT 100.64.0.0/10 (100.64–100.127)
    /8 255.0.0.0 1 (1st) 16,777,216 16,777,214 Private 10.0.0.0/8 block, loopback 127.0.0.0/8

    Reserved IPv4 ranges

    These networks are not routed on the public internet — each block is assigned by its own RFC:

    Range Standard Purpose
    10.0.0.0/8 RFC 1918 Private networks (offices, VPNs, clusters, clouds)
    172.16.0.0/12 RFC 1918 Private networks (172.16.0.0–172.31.255.255); default Docker networks
    192.168.0.0/16 RFC 1918 Private networks (home and small-office routers)
    100.64.0.0/10 RFC 6598 ISP CGNAT (also used by Tailscale)
    127.0.0.0/8 RFC 1122 Loopback — traffic staying inside the host (127.0.0.1, 127.0.0.53)
    169.254.0.0/16 RFC 3927 Link-local (APIPA): self-assigned when DHCP fails to respond
    192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 RFC 5737 Documentation and example ranges (TEST-NET-1/2/3)
    198.18.0.0/15 RFC 2544 Lab network benchmarking
    224.0.0.0/4 RFC 5771 Multicast (224.0.0.0–239.255.255.255: mDNS 224.0.0.251, OSPF)
    0.0.0.0/8 RFC 1122 “This network”; 0.0.0.0 in ss means listen on all IPv4 interfaces
    255.255.255.255/32 RFC 919 Limited broadcast on the local segment (DHCP Discover)

    Reserved IPv6 ranges

    In IPv6, the standard leaf subnet length is /64 (required by SLAAC, IPv6 in practice):

    Prefix Purpose IPv4 counterpart
    ::/128 Unspecified address; [::] in ss means listen on all interfaces 0.0.0.0
    ::1/128 Local host loopback 127.0.0.1
    fe80::/10 Link-local: present on every interface, never routed past a router 169.254.0.0/16
    fc00::/7 (fd00::/8) ULA (Unique Local Address) — private addresses within an organization RFC 1918
    2000::/3 Globally routable addresses (allocated by IANA) Public IPv4
    2001:db8::/32 Documentation and examples (RFC 3849) 203.0.113.0/24
    ff00::/8 Multicast (replaces broadcast in IPv6, powers NDP) 224.0.0.0/4
    ::ffff:0:0/96 IPv4-mapped addresses in dual-stack sockets (::ffff:203.0.113.10) —

    Quick calculations in the terminal

    Command What it does
    python3 -c 'import ipaddress; n=ipaddress.ip_network("10.0.10.42/26", strict=False); print(n, n.netmask, n.broadcast_address, n.num_addresses)' network, netmask, broadcast, and address count with no extra packages
    python3 -c 'import ipaddress; print(ipaddress.ip_address("10.0.10.70") in ipaddress.ip_network("10.0.10.0/26"))' test whether an IP belongs to a subnet
    python3 -c 'import ipaddress; print([str(s) for s in ipaddress.ip_network("10.0.10.0/24").subnets(new_prefix=26)])' split a /24 into four /26 subnets