Network Bytes · Episode 21 · CCNA 1.6
CIDR notation (/24, /26)
The slash in /24 is just a count of the ones in the subnet mask. Here's how 255.255.255.0 becomes /24, and why /26 means 255.255.255.192.
The mask in binary
A subnet mask is 32 bits, written as four parts of 8 bits each. Turn 255.255.255.0 into binary and you get:
11111111.11111111.11111111.00000000
That's 24 ones, then 8 zeros. The ones mark the network part of the address (the street), and the zeros mark the host part (the house numbers on that street). In a mask, the ones always come first, in one unbroken run.
Just count the ones
Writing 32 binary digits every time is slow, so we count the ones instead. Twenty-four ones? Write /24. That count is called the prefix length, and writing an address as 192.168.1.0/24 is CIDR notation (CIDR stands for Classless Inter-Domain Routing). You'll see it in router configs, cloud consoles and firewall rules almost everywhere.
The common ones line up with the dots:
/8=255.0.0.0(8 ones)/16=255.255.0.0(16 ones)/24=255.255.255.0(24 ones)
The fence doesn't have to sit on a dot
The split between network and host can land in the middle of a part. /26 means 26 ones: the first three parts are full (24 ones), and two more ones spill into the last part, giving 11000000. Those two bits are worth 128 and 64, so the last part is 128 + 64 = 192, and the mask is 255.255.255.192.
The street got longer, so there's room for fewer houses. A /24 block leaves 8 host bits, which is 2^8 = 256 addresses. A /26 block leaves only 6 host bits, which is 2^6 = 64 addresses.
Try it yourself
On Windows, run ipconfig in a terminal; on a Mac, open System Settings → Network → Details → TCP/IP. Find your subnet mask (very often 255.255.255.0) and turn it into CIDR by counting the ones: each 255 is 8, each 0 is 0. Then try 255.255.255.192: 8 + 8 + 8 + 2 = /26.
Good to know
- CIDR is defined in IETF RFC 4632. The prefix length can be anything from 0 to 32.
- CIDR replaced the old class A, B and C system, which only allowed masks of /8, /16 and /24. That history is left out of the video.
- Of the 64 addresses in a /26, the first is the network address and the last is the broadcast address, so 62 can be given to hosts. The same rule makes a /24 hold 254 hosts.
For CCNA learners
This lines up with CCNA 200-301 exam topic 1.6, configure and verify IPv4 addressing and subnetting: you need to switch between a dotted mask and its /prefix instantly, including masks like /26 = 255.255.255.192 that don't break on a dot.
Answer to the comment question
The mask 255.255.0.0 is /16. In binary it's 11111111.11111111.00000000.00000000: each 255 is 8 ones and each 0 is 8 zeros, so that's 16 ones, then 16 zeros, and counting the ones gives /16.
Test your knowledge
Quick quiz: CIDR notation (/24, /26)
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- IETF, "RFC 4632, Classless Inter-domain Routing (CIDR)": prefix written as address/length, the number of leading 1 bits from 0 to 32; CIDR replaced classful addressing
- Cisco, "IP Addressing and Subnetting for New Users": mask bits in binary; /24 = 255.255.255.0, /26 = 255.255.255.192
- Cloudflare Learning Center, "What is a subnet?": subnet masks and CIDR notation
- Cisco, CCNA 200-301 v1.1 exam topics: 1.6 configure and verify IPv4 addressing and subnetting
Video transcript
What does the slash in /24 actually mean?
Remember the mask 255.255.255.0? Turn it into binary, and that's 24 ones, then 8 zeros.
Writing all that out is slow. So we just count the ones. 24 ones? Write /24. That's CIDR notation, and it's how you'll see masks almost everywhere.
The fence doesn't have to sit on a dot. /26 means 26 ones, so the last part of the mask becomes 192. The street got longer, so there's room for fewer houses.
/8, /16, /24. Same rule every time: count the ones, and you know where the fence is.
Try one. The mask is 255.255.0.0. What's the slash number? Comment your answer below!
That's your byte.
More from Network Bytes
- EP17Duplex and speed mismatch
- EP18Collisions and why switches killed hubs
- EP19Binary in 60 seconds
- EP23Network, broadcast and usable hosts