ipcalc: network calculator on the command line
August 22nd, 2007 edited by lucasArticle submitted by Javier Barroso. We are running out of articles ! Please help DPOTD and submit good articles about software you like NOW !
Ipcalc is a command-line tool which allows the user to get useful data from a ip and a netmask.
Ipcalc returns the network address, netmask, network address in CIDR notation, min/max IP addresses, broadcast address and the number of hosts of network.
Ipcalc usage is:
Usage: ipcalc [options] <ADDRESS>[[/]<NETMASK>] [NETMASK]
A example could be:
$ ipcalc 10.0.0.28 255.255.255.0 Address: 10.0.0.28 00001010.00000000.00000000. 00011100 Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000 Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111 => Network: 10.0.0.0/24 00001010.00000000.00000000. 00000000 HostMin: 10.0.0.1 00001010.00000000.00000000. 00000001 HostMax: 10.0.0.254 00001010.00000000.00000000. 11111110 Broadcast: 10.0.0.255 00001010.00000000.00000000. 11111111 Hosts/Net: 254 Class A, Private Internet
Ipcalc has been available in Debian at least since v3.1 (’Sarge’) and in Ubuntu since Warty. apt-get install ipcalc
will install it for you.
August 22nd, 2007 at 7:10 am
Nice little tool, Thanks!
August 22nd, 2007 at 9:45 am
Useful!
August 22nd, 2007 at 4:03 pm
Very cool! I have just installed it and I like it very much. Great for network engineers. But aren’t we supposed to be able to do that in our head? Naaah! ;)
August 22nd, 2007 at 8:19 pm
even the same, but more popular:
whatmask
(yum install whatmask or: ./configure;make;make install)
August 22nd, 2007 at 9:19 pm
One useful option is “-n” that don’t display the colors…
e.g.:
ipcalc -n 10.0.0.8/24
…
nice tool !
August 23rd, 2007 at 7:36 pm
Definitely useful. Two alternates: first, search for “ipcalc online”, etc, and use this without installing it. Eg: http://www.faqintosh.com/risorse/en/othutil/webapps/ipcalc/
Second, if you have shorewall installed, it includes a similar facility: “shorewall ipcalc 10.0.0.8/24″
August 24th, 2007 at 9:55 am
¡¡¡¡Nice tool!!!!
August 27th, 2007 at 10:37 am
There is also sipcalc http://www.routemeister.net/projects/sipcalc/ which also supports IPv6…
$ sipcalc 10.0.0.28 255.255.255.0
-[ipv4 : 10.0.0.28 255.255.255.0] - 0
[CIDR]
Host address - 10.0.0.28
Host address (decimal) - 167772188
Host address (hex) - A00001C
Network address - 10.0.0.0
Network mask - 255.255.255.0
Network mask (bits) - 24
Network mask (hex) - FFFFFF00
Broadcast address - 10.0.0.255
Cisco wildcard - 0.0.0.255
Addresses in network - 256
Network range - 10.0.0.0 - 10.0.0.255
Usable range - 10.0.0.1 - 10.0.0.254