ipcalc command to calculate IP information host or network

ipcalc command provides a simple way to calculate IP information for host and network. Based on the options specified, it will provide IP network information in human readable format.

ipcalc command is the default command which will come along with fedora 24 operating system.

ipcalc command

Run ipcalc command as shown in below example, which will verify the IP address and tell you IP address is correct or not. IP class also will be shown in result.

[root@TechTutorials ~]# ipcalc 256.10.10.9/24
ipcalc: bad IPv4 address: 256.10.10.9
[root@TechTutorials ~]# ipcalc 254.10.10.9/24
Address:        254.10.10.9
Network:        254.10.10.0/24
Netmask:        255.255.255.0 = 24
Broadcast:      254.10.10.255

Address space:  Reserved
Address class:  Class E
HostMin:        254.10.10.1
HostMax:        254.10.10.254
Hosts/Net:      25

Below command with option -i will display generic information about given IP / Network

[root@TechTutorials ~]# ipcalc -i 192.168.4.130
Address:        192.168.4.130
Network:        192.168.4.0/24
Netmask:        255.255.255.0 = 24
Broadcast:      192.168.4.255

Address space:  Private Use
Address class:  Class C
HostMin:        192.168.4.1
HostMax:        192.168.4.254
Hosts/Net:      254

Generate Random private IP address by providing Netmask address.

[root@TechTutorials ~]# ipcalc -r 255.255.255.0
Network:        172.16.229.0/24
Netmask:        255.255.255.0 = 24
Broadcast:      172.16.229.255

Address space:  Private Use
Address class:  Class B
HostMin:        172.16.229.1
HostMax:        172.16.229.254
Hosts/Net:      254
[root@TechTutorials ~]# ipcalc -r 255.255.255.0
Network:        192.168.202.0/24
Netmask:        255.255.255.0 = 24
Broadcast:      192.168.202.255

Address space:  Private Use
Address class:  Class C
HostMin:        192.168.202.1
HostMax:        192.168.202.254
Hosts/Net:      254

Provide IP address and get its host name and in reverse way provide Host name and get IP address

[root@TechTutorials ~]# ipcalc -h 192.168.4.132
HOSTNAME=TechTutorials.arkit.co.in
[root@TechTutorials ~]# ipcalc --lookup-host localhost

Check your Broadcast IP address using ipcalc command

[root@TechTutorials ~]# ipcalc -b 192.168.4.132
BROADCAST=192.168.4.255

Know IP address GEO graphical location using ipcalc command see below example

[root@TechTutorials ~]# ipcalc -g 192.168.4.132
COUNTRYCODE=--
[root@TechTutorials ~]# ipcalc -g 8.8.8.8
COUNTRYCODE=US
COUNTRY="United States"

Know Netmask value for given IP address

[root@TechTutorials ~]# ipcalc -m 10.10.10.10
NETMASK=255.0.0.0
[root@TechTutorials ~]# ipcalc -m 255.255.255.255
NETMASK=255.255.255.0
[root@TechTutorials ~]# ipcalc -m 192.168.1.1
NETMASK=255.255.255.0
[root@TechTutorials ~]# ipcalc -m 172.168.1.1
NETMASK=255.255.0.0

Show the Network prefix for given IP address / Mask

[root@TechTutorials ~]# ipcalc -p 192.10.4.130
PREFIX=24
[root@TechTutorials ~]# ipcalc -p 1.10.4.130
PREFIX=8

What is the minimum IP address and Maximum IP Address we can provide in the given IP series / Network, which will also tell you how many hosts you can add to network

[root@TechTutorials ~]# ipcalc --minaddr 192.168.4.130
MINADDR=192.168.4.1
[root@TechTutorials ~]# ipcalc --maxaddr 192.168.4.130
MAXADDR=192.168.4.254
[root@TechTutorials ~]# ipcalc --addresses 192.168.4.130
ADDRESSES=254

Conclusion

ipcalc command is very helpful to understand IP subnetting and Network classes. ipcalc command will support IPV4 and IPv6. Make use in daily activities you will love to explore more.

Thanks,

Please provide your valuable feedback.

Fedora 24 New features and Installation Step by Step Guide

Thanks for your wonderful Support and Encouragement