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 -g, --geoinfo
88 Display geographic information for the given IP address.
89 This option requires libGeoIP/libmaxminddb to be avail‐
90 able. The variables exposed are COUNTRYCODE, COUNTRY,
91 CITY and COORDINATES (when available).
92
93
94 -m, --netmask
95 Calculate the netmask for the given IP address. If no
96 mask or prefix is provided, in IPv6 a 128-bit mask is
97 assumed, while in IPv4 it assumes that the IP address is
98 in a complete class A, B, or C network. Note, however,
99 that many networks no longer use the default netmasks in
100 IPv4. The variable exposed is NETMASK.
101
102
103 -p, --prefix
104 Show the prefix for the given mask/IP address. The vari‐
105 able exposed is PREFIX.
106
107
108 --class-prefix
109 Assign the netmask of the provided IPv4 address based on
110 the address class. This was the default in previous ver‐
111 sions of this software.
112
113
114 -n, --network
115 Display the network address for the given IP address and
116 netmask. The variable exposed is NETWORK.
117
118
119 -n, --reverse-dns
120 Display the reverse DNS for the given IP address and net‐
121 mask. The variable exposed is REVERSEDNS.
122
123
124 --minaddr
125 Display the minimum host address in the provided network.
126 The variable exposed is MINADDR.
127
128
129 --maxaddr
130 Display the maximum host address in the provided network.
131 The variable exposed is MAXADDR.
132
133
134 --addresses
135 Display the number of host addresses in the provided net‐
136 work. The variable exposed is ADDRESSES.
137
138
139 --addrspace
140 Display address space allocation information for the pro‐
141 vided network. The variable exposed is ADDRSPACE.
142
143
144 --no-decorate
145 Print only the requested information. That when combined
146 with split networks option, will only print the networks
147 without any additions for readability.
148
149
150 -s, --silent
151 Don't ever display error messages.
152
153
155 Nikos Mavrogiannopoulos <nmav@redhat.com>
156 Erik Troan <ewt@redhat.com>
157 Preston Brown <pbrown@redhat.com>
158 David Cantrell <dcantrell@redhat.com>
159
160
161
163 Report bugs at https://gitlab.com/ipcalc/ipcalc/issues
164
166 Copyright © 1997-2018 Red Hat, Inc.
167 This is free software; see the source for copying conditions.
168 There is NO warranty; not even for MERCHANTABILITY or FITNESS
169 FOR A PARTICULAR PURPOSE.
170
171
172
173Red Hat, Inc. Oct 1 2018 IPCALC(1)