The “ipcalc” command is a command-line utility that is used to perform simple operations and calculations on IP addresses and networks. It is typically used to calculate the network address, broadcast address, and other information about a given IP address and netmask.
Here are some examples of how the “ipcalc” command can be used:
- To calculate the network address and broadcast address of a given IP address and netmask, use the command “ipcalc [IP address] [netmask]”.
- To display the network address, broadcast address, and other information about a given IP address and netmask, use the command “ipcalc -s [IP address] [netmask]”.
- To calculate the netmask for a given IP address and prefix, use the command “ipcalc -p [IP address] [prefix]”.
The “ipcalc” command can also be used to perform more advanced calculations such as the CIDR notation or prefix notation of a IP address and subnet mask. It is also able to support IPv6 addresses, for example “ipcalc -6 2001:0db8:85a3:0000:0000:8a2e:0370:7334/128”
If you encounter the below error while running the command ipcalc:
ipcalc: command not found
you may try installing the below package as per your choice of distribution:
|Debian||apt-get install ipcalc|
|Ubuntu||apt-get install ipcalc|
|Alpine||apk add ipcalc|
|Arch Linux||pacman -S ipcalc|
|Kali Linux||apt-get install ipcalc|
|CentOS||yum install ipcalc|
|Fedora||dnf install ipcalc|
|OS X||brew install ipcalc|
|Raspbian||apt-get install ipcalc|
ipcalc Command Examples
1. Show information about an address or network with a given subnet mask:
# ipcalc 188.8.131.52 255.255.255.0
2. Show information about an address or network in CIDR notation:
# ipcalc 184.108.40.206/24
3. Show the broadcast address of an address or network:
# ipcalc -b 220.127.116.11/30
4. Show the network address of provided IP address and netmask:
# ipcalc -n 18.104.22.168/24
5. Display geographic information about a given IP address:
# ipcalc -g 22.214.171.124