1IPCALC(1)                   General Commands Manual                  IPCALC(1)
2
3
4

NAME

6       ipcalc - perform simple operations on IP addresses and networks
7

SYNOPSIS

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

DESCRIPTION

13       ipcalc  provides a simple way to calculate IP information for a host or
14       network. Depending on the options specified, it may be used to  provide
15       IP  network  information in human readable format, in a format suitable
16       for parsing in scripts, generate random private addresses,  resolve  an
17       IP address, or check the validity of an address.
18
19       By  default  or  when the --info or --all-info parameters are specified
20       the information provided is free form and  human  readable.  Otherwise,
21       when  specific  options are given (e.g., --prefix) the output is in the
22       VAR=VALUE format.
23
24       The various options specify what information ipcalc should  display  on
25       standard  output. Multiple options may be specified.  It is required to
26       specify an IP address; several operations require a netmask or  a  CIDR
27       prefix as well.
28
29

OPTIONS

31       -c, --check
32              Validate the IP address under the specified family.
33
34
35       -i, --info
36              Display  generic  information  on the provided network in
37              human readable format.  This is the default option if  no
38              other options are provided.
39
40
41       --all-info
42              Display  verbose  information on the provided network and
43              addresses in human readable format. That  includes  GeoIP
44              information.
45
46
47       -S, --split
48              Split  the provided network using the specified prefix or
49              netmask. That is,  split  up  the  network  into  smaller
50              chunks of a specified prefix. When combined with no-deco‐
51              rate mode (--no-decorate), the  split  networks  will  be
52              printed    in   raw   form.   Example   "ipcalc   -S   26
53              192.168.1.0/24".
54
55
56       -d, --deaggregate
57              Deaggregates the provided address range. That  is,  print
58              the  networks  that  cover  the range. The range is given
59              using       the        '-'        separator,        e.g.,
60              "192.168.1.3-192.168.1.23".  When  combined with no-deco‐
61              rate mode (--no-decorate), the networks  are  printed  in
62              raw form.
63
64
65       -r, --random-private
66              Generate a random private address using the supplied pre‐
67              fix or mask. By default it displays output in human read‐
68              able  format,  but  may  be  combined  with other options
69              (e.g., --network)  to  display  specific  information  in
70              VAR=VALUE format.
71
72
73       -h, --hostname
74              Display the hostname for the given IP address.  The vari‐
75              able exposed is HOSTNAME.
76
77
78       -o, --lookup-host
79              Display the IP address for the given hostname.  The vari‐
80              able exposed is ADDRESS.
81
82
83       -4, --ipv4
84              Explicitly specify the IPv4 address family.
85
86
87       -6, --ipv6
88              Explicitly specify the IPv6 address family.
89
90
91       -b, --broadcast
92              Display  the  broadcast  address for the given IP address
93              and netmask.   The  variable  exposed  is  BROADCAST  (if
94              available).
95
96
97       -a, --address
98              Display the IP address for the given input.  The variable
99              exposed is ADDRESS (if available).
100
101
102       -g, --geoinfo
103              Display geographic information for the given IP  address.
104              This  option  requires libGeoIP/libmaxminddb to be avail‐
105              able. The variables  exposed  are  COUNTRYCODE,  COUNTRY,
106              CITY and COORDINATES (when available).
107
108
109       -m, --netmask
110              Calculate  the  netmask  for  the given IP address. If no
111              mask or prefix is provided, in IPv6  a  128-bit  mask  is
112              assumed,  while in IPv4 it assumes that the IP address is
113              in a complete class A, B, or C  network.  Note,  however,
114              that  many networks no longer use the default netmasks in
115              IPv4.  The variable exposed is NETMASK.
116
117
118       -p, --prefix
119              Show the prefix for the given mask/IP address.  The vari‐
120              able exposed is PREFIX.
121
122
123           --class-prefix
124              Assign  the netmask of the provided IPv4 address based on
125              the address class. This was the default in previous  ver‐
126              sions of this software.
127
128
129       -n, --network
130              Display  the network address for the given IP address and
131              netmask.  The variable exposed is NETWORK.
132
133
134           --reverse-dns
135              Display the reverse DNS for the given IP address and net‐
136              mask.  The variable exposed is REVERSEDNS.
137
138
139           --minaddr
140              Display the minimum host address in the provided network.
141              The variable exposed is MINADDR.
142
143
144           --maxaddr
145              Display the maximum host address in the provided network.
146              The variable exposed is MAXADDR.
147
148
149           --addresses
150              Display the number of host addresses in the provided net‐
151              work.  The variable exposed is ADDRESSES.
152
153
154           --addrspace
155              Display address space allocation information for the pro‐
156              vided network.  The variable exposed is ADDRSPACE.
157
158
159           --no-decorate
160              Print  only the requested information. That when combined
161              with split networks option, will only print the  networks
162              without any additions for readability.
163
164
165       -j, --json
166              When  used with -i or -S, print the info as a JSON object
167              instead of the usual output format.
168
169
170       -s, --silent
171              Don't ever display error messages.
172
173

AUTHORS

175       Nikos Mavrogiannopoulos <nmav@redhat.com>
176       Erik Troan <ewt@redhat.com>
177       Preston Brown <pbrown@redhat.com>
178       David Cantrell <dcantrell@redhat.com>
179
180
181

REPORTING BUGS

183       Report bugs at https://gitlab.com/ipcalc/ipcalc/issues
184
186       Copyright © 1997-2018 Red Hat, Inc.
187       This is free software; see the source  for  copying  conditions.
188       There  is  NO  warranty; not even for MERCHANTABILITY or FITNESS
189       FOR A PARTICULAR PURPOSE.
190
191
192
193Red Hat, Inc.                     Oct 1 2018                         IPCALC(1)
Impressum