Linux Calculating Subnets with ipcalc and sipcalc Utilities

If you need to calculate subnet under Linux use an IP Netmask/broadcast calculator called ipcal. You can calculate IPv4 or IPv6 address. Supported features:

=> Multiple address and netmask input formats.
=> Retrieving of address information from interfaces.
=> Classfull and CIDR output.
=> Multiple address and netmask output formats (dotted quad, hex, number of bits).
=> Output of broadcast address, network class, Cisco wildcard, hosts/range, network range.
=> Output of multiple types of bitmaps.

=> Output of a user-defined number of extra networks.
=> Multiple networks input from commandline.
=> DNS resolutions of hostnames.
=> Compressed and expanded input addresses.
=> Compressed and expanded output.

=> Standard IPv6 network output.
=> v4 in v6 output.
=> Reverse dns address generation.
=> The ability to “split” a network based on a smaller netmask, also with recursive runs on the generated subnets.

[a] ipcalc : ipcalc takes an IP address and netmask and calculates the resulting broadcast, network, Cisco wildcard mask, and host range. By giving a second netmask, you can design sub- and supernetworks. It is also intended to be a teaching tool and presents the results as easy to understand binary values. [b] sipcalc : Sipcalc is also an ip subnet calculator consisting of two parts. A plain text based console version, and web (cgi) based counterpart. Sipcalc, in it’s simplest form takes an ip-address and a subnet mask on the commandline and outputs information about the subnet. Sipcalc has support for both IPv4 and IPv6 addresses.

Install sipcalc and ipcalc

Use apt-get command:
$ sudo apt-get install sipcalc ipcalc
Please note that ipcalc is installed by default under RHEL / CentOS / Fedora Linux using initscripts package.


Let us see how to calculate subnets for
$ ipcalc

Address:          11000000.10101000.00000000. 00000001
Netmask: = 24   11111111.11111111.11111111. 00000000
Wildcard:            00000000.00000000.00000000. 11111111
Network:       11000000.10101000.00000000. 00000000
HostMin:          11000000.10101000.00000000. 00000001
HostMax:        11000000.10101000.00000000. 11111110
Broadcast:        11000000.10101000.00000000. 11111111
Hosts/Net: 254                   Class C, Private Internet

You can also try sipcalc:
$ sipcalc

-[ipv4 :] - 0

Host address            -
Host address (decimal)  - 3232235521
Host address (hex)      - C0A80001
Network address         -
Network mask            -
Network mask (bits)     - 24
Network mask (hex)      - FFFFFF00
Broadcast address       -
Cisco wildcard          -
Addresses in network    - 256
Network range           - -
Usable range            - -

More examples:

$ sipcalc

-[ipv4 :] - 0

Host address            -
Host address (decimal)  - 3232235521
Host address (hex)      - C0A80001
Network address         -
Network mask            -
Network mask (bits)     - 17
Network mask (hex)      - FFFF8000
Broadcast address       -
Cisco wildcard          -
Addresses in network    - 32768
Network range           - -
Usable range            - -

-[ipv4 :] - 0

Host address            -
Host address (decimal)  - 4294950912
Host address (hex)      - FFFFC000
Network address         -
Network mask            -
Network mask (bits)     - 32
Network mask (hex)      - FFFFFFFF
Broadcast address       -
Cisco wildcard          -
Addresses in network    - 1
Network range           - -

Display results as HTML

$ ipcalc -h

For more options, please refer to man page:
$ man ipcalc
$ man sipcalc

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • Sk Shahin Rahman Dec 13, 2007 @ 6:27

    i am very much help full by this program but in i need another option for IP Range calculate

  • debug Mar 8, 2008 @ 5:39

    Woa Sk Shahin Rahman, this article is helpful. Guess what, you work with subnets you really should know how to do binary to decimal and calculate all different type of subnets without these tools if needed, right? They are just for convenience and speed, besides you can use these to calculate ranges.

  • debug Mar 8, 2008 @ 5:42

    Actually I just realized that you don’t even need this tool to get range easily. You just look at how many host bits and then your ranges are there counting with however many host bits there are.

  • Teststation Jun 29, 2008 @ 14:33

    I LIKE-IT ….

  • svar Aug 24, 2009 @ 7:33

    Any tutorial’s for calculating subnets? and to learn the casics of ip classification?

  • williamson johanson Dec 17, 2014 @ 20:38

    The ipcalc that comes with red-hat and derivatives sucks.
    The ipcalc for Linux Mint (the one in this article) is fantastic. They are not the same sadly.
    How can I replace the one in red-hat/centos with this one?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum