Netcalc (netcalc) - a safe, fast command line utility program to calculate IPv4/IPv6 network characteristics without touching any system or network configurations.
Compatible with any terminal that supports ANSI escape codes (shell, bash, pwsh, Zsh)
For Windows native PowerShell, you may need to enable ANSI escape code support.
- calculate all network characteristics from any IP address
- identify network type, error when given APIPA address
- CLI11 by CLIUtils (CMakeLists is set up to fetch this dependency on build time)
- (for v0.2.0) fmt by fmtlib (CMakeLists is set up to fetch this dependency on build time)
- bitset (std)
- a C++ 17-compatible compiler (gcc/g++, clang, MSVC etc.)
- CMake 3.16.0 or later
Starting with netcalc 0.3.0, more recent C++ features will be used, prompting a change to the CMakeLIsts.txt in the code base (Latest in main branch). These changes are:
CMake 3.16.0 or laterCMake 3.25.0 or latera C++ 17-compatible compilera C++ 20-compatible compiler (see Compiler Support for C++ 20 for compatible compilers)fmt by fmtlibThis dependency has been removed withnetcalc0.3.0.
These changes are due to the use of the std::format (introduced in C++ 20) from version 0.3.0 forward. That allows for a more maintainable and less verbose source code, also allowing for string interpolation and less verbose text formatting.
- download
netcalc.exe - create a
netcalcdirectory in the root directory of your C drive and placenetcalc.exeinside of it - copy the path to ther parent folder of the executable and paste it into your local
PATHenvironment variable to install it for your account only. To install globally, add the directory to the globalPATHvariable. - Verify installation:
netcalc -h
or
netcalc --help- Download
netcalc-[version]-Linux.tar.gz - extract the package with
tar -xvzf netcalc-[version]-Linux.tar.gz- navigate to the extracted package and find the binary
cd netcalc-[version]-Linux/bin- Finally move the binary to
usr/local/bin
sudo cp netcalc /usr/local/bin- verify installation:
netcalc -h
or
netcalc --help- Clone the repository
git clone https://github.com/yourname/netcalc.git
- move into the directory for your desired version of
netcalccd netcalc - make a build directory and move into it
mkdir build && cd build
- Build the project
cmake .. make
Installers are still a work in progress and do not work yet (help wanted - see Issue #19). It is advised to not download the installers provided in release v0.2.0! In the meantime, binaries, .deb packages and tarballs are available.
Example 1, Calculating all network characteristics
netcalc 192.168.10.50 --sn /24 -ACalculating requested network characteristics for: 192.168.10.50
IP: 192.168.10.50/24
Address type: Private
Subnet Mask: 255.255.255.0
Network Address: 192.168.10.0
Network Range: 192.168.10.0 - 192.168.10.255
Addressable Host Range: 192.168.10.1 - 192.168.10.254
Number of Addressable Hosts: 254
Broadcast Address: 192.168.10.255Example 2, Calculating the network range only
netcalc 10.0.0.0 --sn /8 -rCalculating requested network characteristics for: 10.0.0.0
IP: 10.0.0.0/8
Network Range: 10.0.0.0 - 10.255.255.255Example 3, Identifying network type
netcalc 172.16.5.100 --sn /20 -iIP: 172.16.5.100/20
Address type: PrivateIf you're considering contributing to netcalc, please see CONTRIBUTING.md for instructions and standards for contributing to this project. Thank you for contributing!