Network Bytes · Episode 20 · CCNA 1.6
What a subnet mask does
Every IP address has a network part and a host part. The subnet mask is the fence that shows where one ends and the other begins, like a street and a house number.
Two parts in every address
Every IPv4 address has two parts. The network part says which network the device is on, like the name of your street. The host part says which device it is on that network, like your house number on that street.
The address on its own doesn't tell you where one part stops and the other starts. That's the job of the subnet mask.
The mask is the fence
A subnet mask looks like an address, for example 255.255.255.0. Line it up under the IP address, part by part:
| | Part 1 | Part 2 | Part 3 | Part 4 | |---|---|---|---|---| | Address | 192 | 168 | 1 | 25 | | Mask | 255 | 255 | 255 | 0 | | Meaning | network | network | network | host |
Every 255 means "this part is the street." The 0 means "this part is the house." So for 192.168.1.25 with mask 255.255.255.0, the network is 192.168.1 and the host is 25. The fence sits between the third and fourth parts.
Same street, same network
Devices whose network part matches are on the same network. With mask 255.255.255.0, 192.168.1.10, 192.168.1.25 and 192.168.1.40 are all neighbors on the 192.168.1 street, so they can reach each other directly.
192.168.2.40 is a different street: its third part doesn't match. To reach it, traffic has to leave the street through the router.
Why 255 and 0?
Under the hood, a mask is 32 bits: a run of 1s for the network bits, then 0s for the host bits. 255 is eight 1s (11111111) and 0 is eight 0s (00000000), so 255.255.255.0 is 24 ones followed by 8 zeros. That's why a 255 marks a whole network part and a 0 marks a whole host part.
Try it yourself
Find your own address and mask. On Windows, open Command Prompt and run ipconfig; look for "IPv4 Address" and "Subnet Mask". On a Mac, open System Settings, then Network, then your Wi-Fi or Ethernet connection and Details, then TCP/IP. Home networks very often use 255.255.255.0. Which parts of your address are the street, and which is your house number?
Good to know
- In binary, a mask is a run of 1s (network bits) followed by 0s (host bits); 255 is eight 1s.
- Masks don't have to break on a dot (for example
255.255.255.192). The next lessons on CIDR and subnetting cover those. - "Neighbors" talk directly on the local network (using ARP, covered later); everything else goes through the default gateway.
For CCNA learners
This lines up with CCNA 200-301 exam topic 1.6, configure and verify IPv4 addressing and subnetting: you need to read any address and mask and say which bits are network and which are host, because every subnetting question starts there.
Test your knowledge
Quick quiz: What a subnet mask does
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- Cisco, "IP Addressing and Subnetting for New Users": an IP address has a network part and a host part; the subnet mask marks which bits are which; the 255.255.255.0 example
- Cloudflare Learning Center, "What is a subnet?": subnets are smaller networks inside a larger one; the subnet mask sorts traffic into the right subnet
- IETF, "RFC 950, Internet Standard Subnetting Procedure": the 32-bit address mask, where 1 bits mark the network and subnet fields
- Cisco, CCNA 200-301 v1.1 exam topics: 1.6 configure and verify IPv4 addressing and subnetting
Video transcript
255.255.255.0. It's a fence. Here's where it goes.
Every IP address has two parts. The network part is like your street. The host part is your house number on that street.
The subnet mask shows where the street ends. Every 255 means "this part is the street." The 0 means "this part is the house."
So with 192.168.1.25, the street is 192.168.1, and you're house 25. Every device on that street is your neighbor.
That fence is the subnet mask. It splits the network from the host.
That's your bite. Next: what the slash in /24 means.
More from Network Bytes
- EP15Ports and common port numbers
- EP16Ethernet cables: copper vs fiber
- EP17Duplex and speed mismatch
- EP18Collisions and why switches killed hubs