IPv4 CIDR Subnet Mask Notation
The CIDR number comes from the number of 1’s in the subnet mask when converted to binary.
The common subnet mask 255.255.255.0 is 11111111.11111111.11111111.00000000 in binary.
This adds up to 24 1’s, or /24 (pronounced ‘slash twenty four’).
A subnet mask of 255.255.255.192 is 11111111.11111111.11111111.11000000 in binary, or 26 1’s, hence a /26.
so how to calculate the range and amounts of addresses available in that range:
valid values:
for subnet masks only those values are valid:
00000000 Bin = 0 Dec 11000000 Bin = 192 Dec 11100000 Bin = 224 Dec 11110000 Bin = 248 Dec 11111000 Bin = 252 Dec 11111100 Bin = 254 Dec 11111111 Bin = 255 Dec
Video:
Calculator:
Address: 192.168.0.1 1100ffff.10101000.00ffff00 .00ffff01 Netmask: 255.255.255.0 = 24 11111111.11111111.11111111 .00ffff00 Wildcard: 0.0.0.255 00ffff00.00ffff00.00ffff00 .11111111 => Network: 192.168.0.0/24 11000000.10101000.00ffff00 .00ffff00 (Class C) Broadcast: 192.168.0.255 1100ffff.10101000.00ffff00 .11111111 HostMin: 192.168.0.1 1100ffff.10101000.00ffff00 .00ffff01 HostMax: 192.168.0.254 1100ffff.10101000.00ffff00 .11111110 Hosts/Net: 254 (Private Internet)
another example subnetmask: 255.255.255.240 = 28
allows a range of 14 unique IPv4 addresses in the subnet.
Address: 192.168.2.128 1100ffff.10101000.00ffff10.1000 0000 Netmask: 255.255.255.240 = 28 11111111.11111111.11111111.1111 0000 Wildcard: 0.0.0.15 00ffff00.00ffff00.00ffff00.0000 1111 => Network: 192.168.2.128/28 11000000.10101000.00ffff10.1000 0000 (Class C) Broadcast: 192.168.2.143 1100ffff.10101000.00ffff10.1000 1111 HostMin: 192.168.2.129 1100ffff.10101000.00ffff10.1000 0001 HostMax: 192.168.2.142 1100ffff.10101000.00ffff10.1000 1110 Hosts/Net: 14 (Private Internet)
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!