ipcalc man page

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

-c, --check

Validate the IP address under the specified family.

-i, --info

Display generic information on the provided network in human readable format (default).

--all-info

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

-S, --split

Split the provided network using the specified prefix or netmask. That is, split up the network into smaller chunks of a specified prefix.

-r, --random-private

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.

-h, --hostname

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

-h, --lookup-host

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.

-b, --broadcast

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

-g, --geoinfo

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

-m, --netmask

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.

-p, --prefix

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.

-n, --network

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

-n, --reverse-dns

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.

-s, --silent

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://github.com/nmav/ipcalc/issues

Info

Oct 1 2015 Red Hat, Inc.