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
-c, --check
Validate the IP address under the specified family.
-i, --info
Display generic information on the provided network in human
readable format. This is the default option if no other options
are provided.
--all-info
Display verbose information on the provided network and
addresses in human readable format. That includes GeoIP informa-
tion.
-S, --split
Split the provided network using the specified prefix or net-
mask. That is, split up the network into smaller chunks of a
specified prefix. When combined with no-decorate mode (--no-dec-
orate), the split networks will be printed in raw form.
-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 dis-
play 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 net-
mask. The variable exposed is BROADCAST (if available).
-g, --geoinfo
Display geographic information for the given IP address. This
option requires libGeoIP/libmaxminddb to be available. The vari-
ables 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 net-
mask. 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.
--no-decorate
Print only the requested information. That when combined with
split networks option, will only print the networks without any
additions for readability.
-s, --silent
Don't ever display error messages.
AUTHORS
Nikos Mavrogiannopoulos <nmav AT redhat.com>
Erik Troan <ewt AT redhat.com>
Preston Brown <pbrown AT redhat.com>
David Cantrell <dcantrell AT redhat.com>
REPORTING BUGS
Report bugs at https://gitlab.com/ipcalc/ipcalc/issues
COPYRIGHT
Copyright (C) 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.
Red Hat, Inc. Oct 1 2018 IPCALC(1)