The ipcalc is a command line tool that allows to calculate network and broadcast addresses, wildcard mask, host address range, and number of hosts for a given IPv4 address and netmask.
This tutorial shows how to install ipcalc on Raspberry Pi.
Use SSH to connect to Raspberry Pi. Update the package lists and install ipcalc by using the following commands:
sudo apt update
sudo apt install -y ipcalc
When the installation is completed, we can check ipcalc version:
ipcalc --version
Run the ipcalc
command and provide IPv4 address to perform calculations:
ipcalc 192.168.0.1
An example of output:
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
If the netmask is not provided, ipcalc will use the default netmask for class of the network. Class C network use the default netmask of /24
(255.255.255.0
).
The netmask can be given in CIDR notation:
ipcalc 192.168.0.1/25
or in dotted decimal notation:
ipcalc 192.168.0.1/255.255.255.128
If ipcalc is no longer necessary, you can completely remove it with command:
sudo apt purge --autoremove -y ipcalc
Leave a Comment
Cancel reply