Search

ipcalc: network calculator on the command line

August 22nd, 2007 edited by lucas

Article 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.

Posted in Debian, Ubuntu |

8 Responses

  1. stilus Says:

    Nice little tool, Thanks!

  2. shiny Says:

    Useful!

  3. Tristan Rhodes Says:

    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! ;)

  4. anonymous Says:

    even the same, but more popular:

    whatmask

    (yum install whatmask or: ./configure;make;make install)

  5. action09 Says:

    One useful option is “-n” that don’t display the colors…

    e.g.:

    ipcalc -n 10.0.0.8/24

    nice tool !

  6. mp Says:

    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″

  7. Juanmi Says:

    ¡¡¡¡Nice tool!!!!

  8. ipv6 Says:

    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