IP network calculator
netcalc is a slimmed down clone of sipcalc, using the output format of ipcalc. It is written in C and only depends on a POSIX compliant C library. Both IPv4 and IPv6 are supported.

Build & Install
Debian/Ubuntu
curl -sS https://deb.troglobit.com/pubkey.gpg | sudo tee /etc/apt/trusted.gpg.d/troglobit.asc
echo "deb [arch=amd64] https://deb.troglobit.com/debian stable main" | sudo tee /etc/apt/sources.list.d/troglobit.list
sudo apt-get update && sudo apt-get install netcalc
Docker
Automatically built images available here:
A Dockerfile is provided to simplify building and running netcalc.
docker build -t netcalc:latest .
docker run --rm netcalc:latest netcalc 172.16.10.10/16
Building from Source
First download the latest official release from GitHub:
Always use the versioned tarballs, they contain all required files to be able to build.
Configure & Build
The GNU Configure & Build system use /usr/local as the default install
prefix. Here we override that to use /usr/, the netcalc binary will
then be installed in /usr/bin:
$ ./configure --prefix=/usr
$ make -j5
$ sudo make install-strip
Building from GIT
If you want to contribute, or simply just try out the latest but unreleased features, then you need to know a few things about the [GNU build system][buildsystem]:
configure.acand a per-directoryMakefile.amare key filesconfigureandMakefile.inare generated fromautogen.sh, they are not stored in GIT but automatically generated for the release tarballsMakefileis generated byconfigurescript
To build from GIT; clone the repository and run the autogen.sh script.
This requires the GNU tools automake, autoconf and libtool to be
installed on your system. Released tarballs do not require these tools.
$ sudo apt install git automake autoconf
Then you can clone the repository and create the configure script,
which is not part of the GIT repo:
git clone https://github.com/troglobit/netcalc.git
cd netcalc/
./autogen.sh
./configure && make
GIT sources are a moving target and are not recommended for production systems, unless you know what you are doing!
Origin & References
The original sipcalc project was created by Simon Ekstrand in 2001.
It is no longer actively maintained, but has a lot of features and is
available on major Linux distributions and works on *BSD and Solaris.
Use GitHub to file bug reports, questions, feature requests or patches — preferably as pull requests.
Copyright (c) 2003-2013 Simon Ekstrand
Copyright (c) 2010-2024 Joachim Wiberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.