Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Subnetting  ›  Lesson

Subnet Masks

Subnet Masks 16 minA subnet mask's 1 bits mark the network part of an address and its 0 bits mark the host part, giving two to the power of the host bits minus two usable hosts.

Subnet Masks

Kite Studio has outgrown one flat network: guests on the Wi-Fi can see the file server, and the printer is drowning in broadcasts. The fix is to split 192.168.10.0 into smaller subnets. Every subnet plan rests on one small tool, the subnet mask, which tells a device which part of an address names the network and which part names the host.

The rule

Mask ones mark the network; mask zeros count the hosts.

A subnet mask is 32 bits, like an IPv4 address: a run of 1s followed by a run of 0s. Where the mask has 1s, the address bits are the network part; where it has 0s, they are the host part.

Address  192.168.10.57   11000000.10101000.00001010.00111001
Mask     255.255.255.0   11111111.11111111.11111111.00000000
Network  192.168.10.0    (keep the bits where the mask is 1)

With hh host bits there are 2h2^h addresses in the subnet, and two are reserved:

  • network address — all host bits 0 (192.168.10.0), the name of the subnet;
  • broadcast address — all host bits 1 (192.168.10.255), "everyone on this subnet".

So usable hosts = 2h−22^h - 2. Kite Studio's 255.255.255.0 has 8 host bits: 256 addresses, 254 usable, .1 to .254.

A mask octet can only be one of nine values, because the 1s must be continuous from the left:

1-bits in the octet 0 1 2 3 4 5 6 7 8
Octet value 0 128 192 224 240 248 252 254 255

The shortcut

Learn the ladder by adding halves: 128, +64 = 192, +32 = 224, +16 = 240, +8 = 248, +4 = 252, +2 = 254, +1 = 255. Then, to test whether two hosts share a subnet, AND each address with the mask in the one octet that is not 0 or 255 — the "interesting" octet — and compare the results.

Is `192.168.10.100` on Asha's subnet under mask 255.255.255.192?Step 1 of 4
  1. Find the interesting octet

    The mask is 255.255.255.192, so only the fourth octet needs work.

The trap is forgetting the minus 2. A subnet with 6 host bits has 64 addresses but only 62 usable hosts.

Drills

Answer fast — trust the rule.

Usable hosts on Kite Studio's 255.255.255.0 network:

What's the answer?
28−2= ?2^{8} - 2 = \,?

Usable hosts with mask 255.255.255.192 (6 host bits):

What's the answer?
26−2= ?2^{6} - 2 = \,?
quick drill

Which of these is NOT a valid subnet mask octet?

quick drill

For 192.168.10.57 with mask 255.255.255.0, what is the broadcast address?

quick drill

With mask 255.255.255.192, are 192.168.10.20 and 192.168.10.57 on the same subnet?

Remember

  • Mask ones mark the network; mask zeros count the hosts: 2h−22^h - 2 usable.
  • The ladder: 128, 192, 224, 240, 248, 252, 254, 255.
  • Same subnet? AND both addresses with the mask and compare.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainSame subnet or not?

With mask 255.255.255.192, decide whether 192.168.10.57 and 192.168.10.100 are on the same subnet. Show the AND step, and say how many usable hosts each subnet has.