Search code examples
network-programmingipv4cidr

ipcalc - why it can't give correct network size by default


I found ipcalc didn't give correct network size when not specify the netmask,

In below result, it take the hosts count as 254, but not 2^24 -2,

eric@ePc:~$ ipcalc 101.12.12.12

Address:   101.12.12.12         01100101.00001100.00001100. 00001100
Netmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000
Wildcard:  0.0.0.255            00000000.00000000.00000000. 11111111
=>
Network:   101.12.12.0/24       01100101.00001100.00001100. 00000000
HostMin:   101.12.12.1          01100101.00001100.00001100. 00000001
HostMax:   101.12.12.254        01100101.00001100.00001100. 11111110
Broadcast: 101.12.12.255        01100101.00001100.00001100. 11111111
Hosts/Net: 254                   Class A

But, if I give netmask by hand ipcalc 101.12.12.12/8, then it gives correct result.

I want to know: did ipcalc do this not properly? Or, ipv4 address are used in this way in real world?


Solution

  • classless inter domain routing was invented last century, since then it has not been practical to derive a netmask from a network address,

    101.0.0.0 used to be a class A network, I don't know if it still is, neither does ipcalc.