IP Calculator

Quick post tonight after several days hibernation :D. In my Ubuntu (and other Linux environment), there is a tool named ipcalc that can used as IP address calculator. With this tool, I can easily know what the network address of an certain IP address. I can also know how many client can join into a range of IP address.

For example, I get IP address 10.34.31.34 with network mask 255.255.255.248, with ipcalc I know that the network address for IP 10.34.31.34 is 10.34.41.32. See the log below as appear on my desktop :

tedy@tedy-laptop:~$ ipcalc 10.34.31.34 255.255.255.248
Address:   10.34.31.34          00001010.00100010.00011111.00100 010
Netmask:   255.255.255.248 = 29 11111111.11111111.11111111.11111 000
Wildcard:  0.0.0.7              00000000.00000000.00000000.00000 111
=>
Network:   10.34.31.32/29       00001010.00100010.00011111.00100 000
HostMin:   10.34.31.33          00001010.00100010.00011111.00100 001
HostMax:   10.34.31.38          00001010.00100010.00011111.00100 110
Broadcast: 10.34.31.39          00001010.00100010.00011111.00100 111
Hosts/Net: 6                     Class A, Private Internet
tedy@tedy-laptop:~$

Theoretically to find out what is the network address of any given IP address is simply by do Boolean operation AND between IP address and its netmask. So the step to calculate network address manually is like these :

  1. Convert the IP address & network mask into biner form. This should be long explanation how to convert IP address into biner form.
  2. Then perform Boolean operation : <IP Address> AND <Network Mask>,  just keep in mind that in the AND operation if 1 meet 0 then the result will be 0 (vice versa). Only if 1 meet by 1 then the result would be 1.

That’s it, I can explain it longer, Wikipedia explains t well here. I know the theory but I’m too lazy to do math operation like that :p I’m glad to found simple tool like ipcalc. It makes my life a little bit easier 😀

Leave a Reply