ipcalc Command Examples in Linux

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”

ipcalc Command Examples

1. Show information about an address or network with a given subnet mask:

# ipcalc 1.2.3.4 255.255.255.0

2. Show information about an address or network in CIDR notation:

# ipcalc 1.2.3.4/24

3. Show the broadcast address of an address or network:

# ipcalc -b 1.2.3.4/30

4. Show the network address of provided IP address and netmask:

# ipcalc -n 1.2.3.4/24

5. Display geographic information about a given IP address:

# ipcalc -g 1.2.3.4
Related Post