LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ipcalc

Calculate IP network information

TLDR

Calculate network info
$ ipcalc [192.168.1.0/24]
copy
Show with netmask
$ ipcalc [192.168.1.0] [255.255.255.0]
copy
Split network into subnets
$ ipcalc [192.168.0.0/16] -s [256] [256] [256]
copy
Check if IP is in network
$ ipcalc -c [192.168.1.100] [192.168.1.0/24]
copy
Show binary representation
$ ipcalc -b [192.168.1.0/24]
copy

SYNOPSIS

ipcalc [options] address [netmask]

DESCRIPTION

ipcalc calculates IP network information. It shows network address, broadcast address, host range, and other details from an IP address and netmask or CIDR notation.The tool is essential for network planning, subnetting, and troubleshooting IP configuration issues.

PARAMETERS

address

IP address with optional CIDR.
netmask
Subnet mask (if not CIDR).
-b, --broadcast
Show broadcast address.
-n, --network
Show network address.
-h, --hostname
Show hostname.
-s size...
Split into subnets of size.
-c, --check
Validate address.
--class
Show address class (A, B, C, D, or E).
--minaddr
Show minimum host address.
--maxaddr
Show maximum host address.
-4, -6
Force IPv4/IPv6.
-r, --random-private
Generate a random private address for given prefix length.
--no-decorate
Print output without decoration (suitable for scripting).

CAVEATS

Two distinct implementations exist: the Red Hat version (ipcalc from initscripts) and the newer ipcalc by Nikos Mavrogiannopoulos. They have different options and features. The `-s` subnet splitting and `-c` check options are only available in certain versions. IPv6 support is available in the newer implementation only.

HISTORY

ipcalc has multiple implementations. The original was part of the Red Hat initscripts package. A newer, more feature-rich version was written by Nikos Mavrogiannopoulos with IPv6 support and additional calculation features.

SEE ALSO

sipcalc(1), ip(8), ifconfig(8)

Copied to clipboard
Kai