1IPCALC(1) General Commands Manual IPCALC(1)
2
3
4
6 ipcalc - perform simple operations on IP addresses and networks
7
9 ipcalc [OPTION]... <IP address>[/prefix] [netmask]
10
11
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
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.
53
54
55 -r, --random-private
56 Generate a random private address using the supplied pre‐
57 fix or mask. By default it displays output in human read‐
58 able format, but may be combined with other options
59 (e.g., --network) to display specific information in
60 VAR=VALUE format.
61
62
63 -h, --hostname
64 Display the hostname for the given IP address. The vari‐
65 able exposed is HOSTNAME.
66
67
68 -h, --lookup-host
69 Display the IP address for the given hostname. The vari‐
70 able exposed is ADDRESS.
71
72
73 -4, --ipv4
74 Explicitly specify the IPv4 address family.
75
76
77 -6, --ipv6
78 Explicitly specify the IPv6 address family.
79
80
81 -b, --broadcast
82 Display the broadcast address for the given IP address
83 and netmask. The variable exposed is BROADCAST (if
84 available).
85
86
87 -a, --address
88 Display the IP address for the given input. The variable
89 exposed is ADDRESS (if available).
90
91
92 -g, --geoinfo
93 Display geographic information for the given IP address.
94 This option requires libGeoIP/libmaxminddb to be avail‐
95 able. The variables exposed are COUNTRYCODE, COUNTRY,
96 CITY and COORDINATES (when available).
97
98
99 -m, --netmask
100 Calculate the netmask for the given IP address. If no
101 mask or prefix is provided, in IPv6 a 128-bit mask is
102 assumed, while in IPv4 it assumes that the IP address is
103 in a complete class A, B, or C network. Note, however,
104 that many networks no longer use the default netmasks in
105 IPv4. The variable exposed is NETMASK.
106
107
108 -p, --prefix
109 Show the prefix for the given mask/IP address. The vari‐
110 able exposed is PREFIX.
111
112
113 --class-prefix
114 Assign the netmask of the provided IPv4 address based on
115 the address class. This was the default in previous ver‐
116 sions of this software.
117
118
119 -n, --network
120 Display the network address for the given IP address and
121 netmask. The variable exposed is NETWORK.
122
123
124 --reverse-dns
125 Display the reverse DNS for the given IP address and net‐
126 mask. The variable exposed is REVERSEDNS.
127
128
129 --minaddr
130 Display the minimum host address in the provided network.
131 The variable exposed is MINADDR.
132
133
134 --maxaddr
135 Display the maximum host address in the provided network.
136 The variable exposed is MAXADDR.
137
138
139 --addresses
140 Display the number of host addresses in the provided net‐
141 work. The variable exposed is ADDRESSES.
142
143
144 --addrspace
145 Display address space allocation information for the pro‐
146 vided network. The variable exposed is ADDRSPACE.
147
148
149 --no-decorate
150 Print only the requested information. That when combined
151 with split networks option, will only print the networks
152 without any additions for readability.
153
154
155 -j, --json
156 When used with -i or -S, print the info as a JSON object
157 instead of the usual output format.
158
159
160 -s, --silent
161 Don't ever display error messages.
162
163
165 Nikos Mavrogiannopoulos <nmav@redhat.com>
166 Erik Troan <ewt@redhat.com>
167 Preston Brown <pbrown@redhat.com>
168 David Cantrell <dcantrell@redhat.com>
169
170
171
173 Report bugs at https://gitlab.com/ipcalc/ipcalc/issues
174
176 Copyright © 1997-2018 Red Hat, Inc.
177 This is free software; see the source for copying conditions.
178 There is NO warranty; not even for MERCHANTABILITY or FITNESS
179 FOR A PARTICULAR PURPOSE.
180
181
182
183Red Hat, Inc. Oct 1 2018 IPCALC(1)