Install ipcalc on Ubuntu 20.04

The ipcalc is a command line tool for calculating network and broadcast addresses, wildcard mask, host address range, and number of hosts for a given IPv4 address and netmask.

This tutorial demonstrates how to install ipcalc on Ubuntu 20.04.

Install ipcalc

Run the following command to update the package lists:

sudo apt update

Install ipcalc:

sudo apt install -y ipcalc

When installation is completed, we can check version of ipcalc:

ipcalc --version

Testing ipcalc

Execute the ipcalc command and provide IPv4 address to perform calculations:

ipcalc 192.168.0.1

Output example:

Address:   192.168.0.1          11000000.10101000.00000000. 00000001
Netmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000
Wildcard:  0.0.0.255            00000000.00000000.00000000. 11111111
=>
Network:   192.168.0.0/24       11000000.10101000.00000000. 00000000
HostMin:   192.168.0.1          11000000.10101000.00000000. 00000001
HostMax:   192.168.0.254        11000000.10101000.00000000. 11111110
Broadcast: 192.168.0.255        11000000.10101000.00000000. 11111111
Hosts/Net: 254                   Class C, Private Internet

By default, ipcalc uses default netmask for class of the network. Class C network use the default netmask of /24 (255.255.255.0).

We can provide the netmask in CIDR notation as follows:

ipcalc 192.168.0.1/25

or in dotted decimal notation:

ipcalc 192.168.0.1/255.255.255.128

Uninstall ipcalc

If the ipcalc is no longer needed, you can remove it:

sudo apt purge --autoremove -y ipcalc

Leave a Comment

Your email address will not be published.