Scroll to navigation

IPCALC(1) General Commands Manual IPCALC(1)

NAME

ipcalc - perform simple operations on IP addresses and networks

SYNOPSIS

ipcalc [OPTION]... <IP address>[/prefix] [netmask]

DESCRIPTION

ipcalc provides a simple way to calculate IP information for a host or network. Depending on the options specified, it may be used to provide IP network information in human readable format, in a format suitable for parsing in scripts, generate random private addresses, resolve an IP address, or check the validity of an address.

By default or when the --info or --all-info parameters are specified the information provided is free form and human readable. Otherwise, when specific options are given (e.g., --prefix) the output is in the VAR=VALUE format.

The various options specify what information ipcalc should display on standard output. Multiple options may be specified. It is required to specify an IP address; several operations require a netmask or a CIDR prefix as well.

OPTIONS

Validate the IP address under the specified family.

Display generic information on the provided network in human readable format. This is the default option if no other options are provided.

Display verbose information on the provided network and addresses in human readable format. That includes GeoIP information.

Split the provided network using the specified prefix or netmask. That is, split up the network into smaller chunks of a specified prefix. When combined with no-decorate mode (--no-decorate), the split networks will be printed in raw form.

Generate a random private address using the supplied prefix or mask. By default it displays output in human readable format, but may be combined with other options (e.g., --network) to display specific information in VAR=VALUE format.

Display the hostname for the given IP address. The variable exposed is HOSTNAME.

Display the IP address for the given hostname. The variable exposed is ADDRESS.

-4, --ipv4
Explicitly specify the IPv4 address family.

-6, --ipv6
Explicitly specify the IPv6 address family.

Display the broadcast address for the given IP address and netmask. The variable exposed is BROADCAST (if available).

Display geographic information for the given IP address. This option requires libGeoIP/libmaxminddb to be available. The variables exposed are COUNTRYCODE, COUNTRY, CITY and COORDINATES (when available).

Calculate the netmask for the given IP address. If no mask or prefix is provided, in IPv6 a 128-bit mask is assumed, while in IPv4 it assumes that the IP address is in a complete class A, B, or C network. Note, however, that many networks no longer use the default netmasks in IPv4. The variable exposed is NETMASK.

Show the prefix for the given mask/IP address. The variable exposed is PREFIX.

  --class-prefix
Assign the netmask of the provided IPv4 address based on the address class. This was the default in previous versions of this software.

Display the network address for the given IP address and netmask. The variable exposed is NETWORK.

Display the reverse DNS for the given IP address and netmask. The variable exposed is REVERSEDNS.

  --minaddr
Display the minimum host address in the provided network. The variable exposed is MINADDR.

  --maxaddr
Display the maximum host address in the provided network. The variable exposed is MAXADDR.

  --addresses
Display the number of host addresses in the provided network. The variable exposed is ADDRESSES.

  --addrspace
Display address space allocation information for the provided network. The variable exposed is ADDRSPACE.

  --no-decorate
Print only the requested information. That when combined with split networks option, will only print the networks without any additions for readability.

Don't ever display error messages.

AUTHORS

Nikos Mavrogiannopoulos <nmav@redhat.com>

Erik Troan <ewt@redhat.com>
Preston Brown <pbrown@redhat.com>
David Cantrell <dcantrell@redhat.com>

REPORTING BUGS

Report bugs at https://gitlab.com/ipcalc/ipcalc/issues

COPYRIGHT

Copyright © 1997-2018 Red Hat, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Oct 1 2018 Red Hat, Inc.