Posts

Showing posts with the label Mask

Ip addresses and subnets calculation

Many people do not clearly understand how IPv4 CIDR notation actually works. Let me explain it for you in binary arithmetic. Let's take a very common class C ip address: 192.168.1.1 Its binary representation is:  11000000.10101000.00000001.00000001 IP address actually consists of 32 bits. Those dots are splitting 32 bit value in 4 chunks: 192 -  11000000 168 - 10101000 1 - 00000001 1 - 00000001 Easy, huh? Now let's take the subnet 192.168.1.0/24. So what does /24 actually mean? It means that 24 bits  used to identify network and all other bits (8 in this case) are used to identify IP address. Binary representation of 192.168.1.0 is 11000000.10101000.00000001 .00000000 As I've mentioned above 24 bits are used to identify network (they are marked in bold). 8 bits are left to represent IP address and maximum value is 11111111 - 255 in decimal. Last IP address is reserved as broadcast. So network consists of 254 hosts. More confusing example: 211.240.192...