Tonight I just stumbled on a command line tool or utility called ipcacl. This tool is used to perform operations on IP addresses and networks.

On Fedora, ipcalc is provided by ipcacl package. If you on a different distro, search for ipcaclc, there should be a similar package name.

➜ rpm -q ipcalc
ipcalc-1.0.3-9.fc40.x86_64

Here are some examples of what we can use this utility for, though I encourage you to run man ipcalc to learn more what you can do with it.

➜ ipcalc 192.168.1.0/24 -j
{
  "NETWORK":"192.168.1.0",
  "NETMASK":"255.255.255.0",
  "PREFIX":"24",
  "BROADCAST":"192.168.1.255",
  "ADDRSPACE":"Private Use",
  "MINADDR":"192.168.1.1",
  "MAXADDR":"192.168.1.254",
  "ADDRESSES":"254"
}
➜ ipcalc --all-info -j 192.168.1.0/24
{
  "NETWORK":"192.168.1.0",
  "NETMASK":"255.255.255.0",
  "PREFIX":"24",
  "BROADCAST":"192.168.1.255",
  "REVERSEDNS":"1.168.192.in-addr.arpa.",
  "ADDRSPACE":"Private Use",
  "ADDRCLASS":"Class C",
  "MINADDR":"192.168.1.1",
  "MAXADDR":"192.168.1.254",
  "ADDRESSES":"254"
}

and one example with ipv6:

➜ ipcalc --all-info -j fe80::d6c9:efff:fef1:3783/64
{
  "FULLADDRESS":"fe80:0000:0000:0000:d6c9:efff:fef1:3783",
  "ADDRESS":"fe80::d6c9:efff:fef1:3783",
  "FULLNETWORK":"fe80:0000:0000:0000:0000:0000:0000:0000",
  "NETWORK":"fe80::",
  "NETMASK":"ffff:ffff:ffff:ffff::",
  "PREFIX":"64",
  "REVERSEDNS":"0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa.",
  "ADDRSPACE":"Link-Scoped Unicast",
  "MINADDR":"fe80::",
  "MAXADDR":"fe80::ffff:ffff:ffff:ffff",
  "ADDRESSES":"18446744073709551616"
}

Happy ipcalc-ulating!