PracticeLabs
Week 2Lesson 1Required27 min estimated0% progress

Subnetting Mental Model

Build the model behind every subnetting problem — network bits versus host bits — with just enough binary and hexadecimal to see exactly where the mask draws the line.

Lesson orientation

What you'll learn (4 objectives)~27 min: video → lesson → check → apply → lab prep

Learning objectives

  • Explain how a subnet mask divides a 32-bit address into network bits and host bits
  • Convert a single octet between decimal, binary, and hexadecimal
  • Compute how many usable hosts a given number of host bits provides using 2^h − 2
  • Locate the interesting octet where a mask splits, and predict the subnet block size

Terms you will see

Subnet maskPrefix lengthNetwork bitsHost bitsPlace valueBinaryHexadecimalNibbleUsable hostsInteresting octetBlock size

Time breakdown

  • Read the notes12 min
  • Binary & Hex lab8 min
  • Worked examples and predictions7 min

One address, two jobs

Week 1 left you able to read an IPv4 address: 32 bits, four octets, and a mask that decides where the network portion ends. This week turns that into arithmetic you can do. Everything rests on a single idea, so it is worth stating precisely.

Network bits and host bits
Every IPv4 address is 32 bits, and the mask decides how those bits are spent. Mask bits set to 1 mark the network portion — the part every device in the subnet shares. Mask bits set to 0 mark the host portion — the part that differs from one device to the next. The prefix length is simply a count of the 1 bits, so /26 means 26 network bits and therefore 32 − 26 = 6 host bits.

It is a fixed budget. There are always exactly 32 bits, so the boundary can move but the total cannot. Push the boundary right — a longer prefix — and you gain more subnets while leaving fewer host bits, so each subnet holds fewer devices. Push it left and the reverse happens. You cannot gain subnets and hosts at the same time; you are trading one against the other along a fixed line.

The see-saw
More subnet bits never means more hosts. Each extra network bit doubles the number of subnets and halves the hosts in each one. If an exam answer claims both went up, it is wrong before you check any arithmetic.

Counting hosts: why it is 2^h − 2

With h host bits, the subnet contains 2^h addresses in total — every combination those bits can take. Two of them are not assignable to a device. The address with all host bits set to 0 is the network address, which names the subnet itself. The address with all host bits set to 1 is the broadcast address for that subnet. So the count of usable host addresses is 2^h − 2.

Host bits, total addresses, and usable hosts
Host bits (h)PrefixTotal addresses (2^h)Usable hosts (2^h − 2)
2/3042
3/2986
4/281614
5/273230
6/266462
7/25128126
8/24256254

Read that table in both directions. Given a prefix you can state the usable hosts; given a host requirement you can find the smallest prefix that satisfies it. Lesson 4 leans on the second direction constantly, so it is worth being able to reproduce these seven rows from the powers of two rather than from memory.

Binary in one octet

An octet is eight bit positions, and each position is worth a power of two. Reading them left to right, the place values are:

Place values and one example octet
Place value:  128   64   32   16    8    4    2    1
Bit:            1    1    0    0    0    0    0    0   = 192
Bit:            1    1    0    0    1    0    0    0   = 200

To convert binary to decimal, add the place values wherever the bit is 1. So 11000000 is 128 + 64 = 192, and 11001000 is 128 + 64 + 8 = 200. To convert decimal to binary, take the largest place value that fits, subtract it, and repeat with the remainder: 200 minus 128 leaves 72; 72 minus 64 leaves 8; 8 fits exactly. Bits set at 128, 64, and 8 gives 11001000.

Why mask octets look the way they do
A mask fills its 1 bits from the left with no gaps, so only eight octet values are ever legal in a mask: 128, 192, 224, 240, 248, 252, 254, 255. Each is the running total of the place values as you switch bits on left to right. A mask octet of 100 or 63 is not a typo you should try to interpret — it is invalid.

Hexadecimal in one nibble

Hexadecimal packs exactly four bits into a single digit, counting 0 through 9 and then A through F for 10 through 15. Four bits is called a nibble, and since an octet is two nibbles, one octet is always two hex digits.

Take 192 again. In binary it is 11000000, which splits into 1100 and 0000. The first nibble is 8 + 4 = 12, which is C. The second is 0. So 192 is 0xC0. The relationship is exact and mechanical in both directions, which is why hex is used wherever long bit strings would be unreadable.

The nibble-to-hex mapping worth knowing on sight
BinaryDecimalHex
000000
000111
011177
100088
101010A
110012C
111014E
111115F

For subnetting itself, binary is the workhorse and hex barely appears. Hex matters when you read MAC addresses, which you met in Week 1, and IPv6 addresses later in the course. It is defined here because this is the one lesson in the course that teaches base conversion, and splitting it across two places would guarantee it is learned in neither.

The interesting octet and the block size

Here is the shortcut the rest of the week is built on. In any mask there is at most one octet that is neither 255 nor 0 — the octet where the boundary actually falls. Call it the interesting octet. The block size is 256 minus that octet's value, and it tells you how far apart consecutive subnets sit in that octet.

Worked example: 192.168.1.0/26. A /26 is 24 network bits — a full 255.255.255 — plus 2 more bits in the fourth octet. Two bits from the left is 128 + 64 = 192, so the mask is 255.255.255.192 and the fourth octet is the interesting one. Block size is 256 − 192 = 64, so the subnets step by 64: .0, .64, .128, and .192. That is four subnets carved out of the original /24, each with 6 host bits and therefore 62 usable addresses.

192.168.1.0/24 divided into four /26 subnets
SubnetNetworkFirst hostLast hostBroadcast
1192.168.1.0192.168.1.1192.168.1.62192.168.1.63
2192.168.1.64192.168.1.65192.168.1.126192.168.1.127
3192.168.1.128192.168.1.129192.168.1.190192.168.1.191
4192.168.1.192192.168.1.193192.168.1.254192.168.1.255

Check the pattern in that table rather than memorising it. Each network address is a multiple of the block size. Each broadcast is the next network address minus one. The usable hosts are everything strictly between them. Lesson 2 turns this into a procedure you can run on any address in a few seconds.

What you should retain

  • Mask 1 bits are network, 0 bits are host, and the 32 bits are a fixed budget you trade between subnets and hosts.
  • Octet place values are 128 64 32 16 8 4 2 1 — add the on-bits to read decimal, subtract greedily to write binary.
  • Only eight octet values are legal in a mask: 128, 192, 224, 240, 248, 252, 254, 255.
  • One hex digit is four bits, so one octet is two hex digits; 192 is 0xC0.
  • Usable hosts = 2^h − 2, dropping the network and broadcast addresses.
  • Block size = 256 − the interesting mask octet, and subnets step by that block.
Pause and predictNot scored — nothing is recorded

Before you read on

Convert the mask octet 11110000 to decimal. Then say how many host bits it leaves in that octet, and what the full mask 255.255.255.240 is as a prefix length and a usable-host count.

Interactive tool
Required~8 min

Binary, Hex & Addressing Lab

Convert octets and mask values between decimal, binary, and hex until it stops requiring thought. Everything in the next three lessons assumes you can do this conversion quickly, and it is the one part of subnetting that only becomes fast through repetition.

Study deeper

Topic guides extend this lesson — they do not replace the first-party walkthrough above.

IP Addressing & Subnetting

For the hexadecimal reference and the classful A/B/C background this lesson deliberately skips — useful if the base conversion above needs a second explanation