Simple IP address calculator
ipcalc command is a simple ip address calculator that can complete simple IP address calculation tasks.
ipcalc(options)
-b: Calculate the broadcast address from the given IP address and network mask;
-h: Display the host name corresponding to the given UP address;
-m: Calculate the network mask from the given IP address;
-p: Display the given mask or prefix of the IP address;
-n: Calculate the network address from the given IP address and network mask;
-s: quiet mode;
--help: Display help information.
[root@localhost ~]# ipcalc -p 192.168.2.1 255.255.255.0
PREFIX=24
[root@localhost ~]# ipcalc -n 192.168.2.1 255.255.255.0
NETWORK=192.168.2.0
[root@localhost ~]# ipcalc -h 127.0.0.1
hostname=localhost.localdomain
[root@localhost ~]# ipcalc -m 192.168.2.1
NETMASK=255.255.255.0
[root@localhost ~]# ipcalc -pnbm 192.168.2.1 255.255.255.0
NETMASK=255.255.255.0
PREFIX=24
BROADCAST=192.168.2.255
NETWORK=192.168.2.0