ipcalc
Calculate IP network information
TLDR
Display network info for an IP address
Display network info using CIDR notation
Display network info using a dotted decimal netmask
Suppress bitwise output
Split a network into specified sized blocks
Display version
SYNOPSIS
ipcalc [-46bcdfhmnoPrsuv] [ADDRESS[/PREFIXLEN]]
PARAMETERS
-4
IPv4 only
-6
IPv6 only
-b
Show broadcast address
-c
Show IP class (A/B/C)
-d
Deaggregate /24 networks
-f
Read netmask from file
-h
Show help
-m
Show netmask
-n
Show network address
-o
Show one-to-one mapping
-p
Show prefix length
-P
Check if private address
-r
Show host range
-s
Silent mode, set exit code
-u
Show unique hosts count
-v
Show version
DESCRIPTION
ipcalc is a command-line tool for computing IP address information, including subnet details, for both IPv4 and IPv6. It takes an IP address with optional netmask or prefix length and outputs key network parameters such as the network address, broadcast address, netmask in CIDR, dotted decimal, hex and octal formats, hostmin, hostmax, total addresses, usable hosts, and host bits.
By default, ipcalc 192.168.1.0/24 displays a concise summary like:
Address: 192.168.1.0 11000000.10101000.00000001.00000000
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111.00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000.11111111
=> Network: 192.168.1.0/24 11000000.10101000.00000001.00000000
HostMin: 192.168.1.1 11000000.10101000.00000001.00000001
HostMax: 192.168.1.254 11000000.10101000.00000001.11111110
Broadcast: 192.168.1.255 11000000.10101000.00000001.11111111
- Number of hosts: 254 11000000.10101000.00000001.0xxxxxxx
Ideal for network admins to quickly verify subnet configurations without GUI tools. Supports checks for private, loopback, and unspecified addresses.
CAVEATS
Not installed by default; install via apt install ipcalc or equivalent. Limited IPv6 deaggregation support in older versions.
EXAMPLE USAGE
ipcalc 10.0.0.0/8
Outputs class A network details with 16M hosts.
ipcalc -P 2001:db8::/32
Checks if IPv6 is private.
HISTORY
Developed in the 1990s by early Linux enthusiasts; IPv6 support added around 2005. Maintained as open-source, now in distro packages like Debian's ipcalc.


