ZWIEGNET Linux Consultants
$ ipcalc

IPv4 Subnet Calculator

Calculate network, broadcast, host range, and address counts from an IPv4 address and prefix length.

How the IPv4 calculator works

The box takes an address and a prefix length, written the way a route or an interface is written: 192.168.1.10/24. The prefix is the number of leading bits that identify the network. The remaining bits identify the host. A /24 leaves 8 host bits, which is 256 addresses. A /32 is a single host. A /31 is a two-address link, used on point-to-point networks, and it has no separate broadcast address in the usual sense.

The network address is the address with the host bits set to zero. The broadcast address, for prefixes shorter than 31, is the address with the host bits set to one. Usable hosts are the addresses between them. On a /24 that is 254 hosts, because the all-zero and all-ones addresses are reserved for the network and the broadcast. The calculator shows the mask both as a dotted quad and as the prefix, so you can compare it with the ifcfg or NetworkManager setting.

Type a real address from the host, not only the network address. 192.168.1.10/24 and 192.168.1.0/24 produce the same network, broadcast, and range. That is the point of the mask. What it will not do is plan VLANs for you, or tell you whether the gateway is inside the range. A gateway that is not inside the network address and the broadcast is a different subnet, and packets to it need a route.

Limitations: this is IPv4 only, and it does not check that the address is assigned on an interface. It does not know about secondary addresses, policy routing, or NAT. A /0 is the whole IPv4 space and is rarely what a host mask should be. If the field is rejected, the prefix is outside 0 through 32 or an octet is outside 0 through 255.