LinuxCommandLibrary

ipcalc

Calculate IP network information

TLDR

Display network info for an IP address

$ ipcalc [192.168.0.1]
copy

Display network info using CIDR notation
$ ipcalc [192.168.0.1]/[24]
copy

Display network info using a dotted decimal netmask
$ ipcalc [192.168.0.1] [255.255.255.0]
copy

Suppress bitwise output
$ ipcalc [[-b|--nobinary]] [192.168.0.1]
copy

Split a network into specified sized blocks
$ ipcalc [[-s|--split]] [size1 size2 size3 ...] [192.168.0.1]
copy

Show version information
$ ipcalc [[-v|--version]]
copy

SYNOPSIS

ipcalc [options] <ip address>[/<prefix length>] [netmask]

PARAMETERS

-b
    Display the broadcast address.

-n
    Display the network address.

-m
    Display the netmask in dotted decimal notation.

-p
    Display the prefix length.

-s
    Display the network size.

-h
    Display the number of hosts.

-i
    Display the host range.

-c
    Check if a given IP address belongs to a network.

-v
    Be verbose. Display more information.

-4
    Force IPv4 mode.

-6
    Force IPv6 mode.

--help
    Display a help message and exit.

--version
    Display version information and exit.

DESCRIPTION

The ipcalc command is a utility designed to perform various IP address and network calculations. It takes an IP address and netmask (or CIDR notation) as input and outputs a wealth of information about the network, including the network address, broadcast address, usable host range, number of hosts, and more. It is extremely useful for network administrators and developers who need to quickly understand the properties of a given IP network. It can also be used to check if a given IP address belongs to a specific network. ipcalc supports both IPv4 and IPv6 addresses.

ipcalc is a valuable tool for simplifying network management tasks and troubleshooting network-related issues by providing clear and concise network information.

CAVEATS

The accuracy of the calculations depends on the validity of the input IP address and netmask. Invalid inputs may produce incorrect results.

EXAMPLES

ipcalc 192.168.1.10/24
Displays network information for the 192.168.1.10 IP address with a /24 subnet mask.

ipcalc -n 10.0.0.5/8
Displays the network address for 10.0.0.5/8.

ipcalc -c 192.168.1.10/24 192.168.1.15
Checks if 192.168.1.15 belongs to the 192.168.1.0/24 network.

SEE ALSO

ifconfig(8), route(8), netstat(1)

Copied to clipboard