Calculate network, broadcast, netmask, etc with ipcalc

Valic —  June 9, 2010 — Leave a comment

Ipcalc is a simple tool to calculate network, broadcast, netmask, etc. from an IP address.

It also gives the class of the IP. It might facilitate the work of network admins.

Here is an example of using it against a “local” IP address:

Example 1:

Deb:~# ipcalc 192.168.4.25
Address: 192.168.4.25 11000000.10101000.00000100. 00011001
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111
=>
Network: 192.168.4.0/24 11000000.10101000.00000100. 00000000
HostMin: 192.168.4.1 11000000.10101000.00000100. 00000001
HostMax: 192.168.4.254 11000000.10101000.00000100. 11111110
Broadcast: 192.168.4.255 11000000.10101000.00000100. 11111111
Hosts/Net: 254 Class C, Private Internet

Example 2:

Deb:~# ipcalc 89.40.0.35
Address: 89.40.0.35 01011001.00101000.00000000. 00100011
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111
=>
Network: 89.40.0.0/24 01011001.00101000.00000000. 00000000
HostMin: 89.40.0.1 01011001.00101000.00000000. 00000001
HostMax: 89.40.0.254 01011001.00101000.00000000. 11111110
Broadcast: 89.40.0.255 01011001.00101000.00000000. 11111111
Hosts/Net: 254 Class A



You may also invoke it with the -h flag to cause the tool to generate HTML output which may be useful for displaying online:

ipcalc -h 192.168.4.100 > ipcalc.html

Inslallation:

apt-get install ipcalc

Done.

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

No Comments

Be the first to start the conversation.

Leave a Reply