FR FieldReady Academy
Unit 4ConceptsObjective 1.78 min read

IPv4 Basics and Address Classes

Unit 4: IP Addressing and Subnetting. Lesson 11 of 49 in NetPlus Academy.

An IPv4 address is 32 bits, written as four decimal octets from 0 to 255, such as 172.16.40.9. Part of it identifies the network, the rest identifies the host on that network. The subnet mask says where the split is: a 1 bit in the mask means network, a 0 bit means host.

Reading a mask

255.255.255.0 is 24 ones followed by 8 zeros, written as /24 in CIDR notation. Octet values you must recognize as masks: 128, 192, 224, 240, 248, 252, 254, 255, which correspond to 1 through 8 network bits in that octet. So 255.255.255.224 is /27 and 255.255.240.0 is /20.

Binary in one minute

Each octet's bits are worth 128, 64, 32, 16, 8, 4, 2, 1. Add the bits that are on. 192 is 128 plus 64, so its binary is 11000000. You only need this for masks and for spotting which half of a subnet a host falls into.

The historical classes

Classful addressing is retired in favor of CIDR, but the exam still expects you to recognize the ranges by first octet:

  • Class A: 1 to 126, default mask /8. Huge networks.
  • Class B: 128 to 191, default mask /16.
  • Class C: 192 to 223, default mask /24. Small networks.
  • Class D: 224 to 239, multicast, not assigned to hosts.
  • Class E: 240 to 255, experimental.

127 is skipped because 127.0.0.0/8 is reserved for loopback; 127.0.0.1 always means "this host."

Two addresses you never assign

In every subnet the all-zeros host address is the network address and the all-ones host address is the broadcast address. Everything between them is usable.

Exam tip: "how many bits" questions are just mask arithmetic. /27 leaves 5 host bits. A first octet of 172 is Class B; 10 is Class A; 200 is Class C.
Remember
Mask octets: 128 192 224 240 248 252 254 255. Class A 1-126 /8, B 128-191 /16, C 192-223 /24, 127 loopback.
Deeper explanation

IPv4 Basics and Address Classes, explained slowly

Stop seeing four numbers

The easiest way to understand IPv4 is to stop thinking of it as four numbers and think of it as two parts glued together:

IP address = NETWORK part + HOST part

The subnet mask is the only thing that tells you where the network part ends and the host part begins.

1. A street address

Take 172.16.40.9. Read it like a mailing address: 172.16.40 is the neighborhood, 9 is the house. That is not always literally how it splits, but it is the right mental picture.

With a mask of /24 it really is that split:

172 . 16 . 40 . 9
|------------|  |
   NETWORK     HOST
   24 bits     8 bits

2. Why 32 bits and why 0 to 255

An IPv4 address is four octets. An octet is 8 bits, so 8 + 8 + 8 + 8 = 32 bits. Each bit in an octet is worth a fixed amount:

128   64   32   16   8   4   2   1

Turn every bit on and add them up: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. Turn them all off: 0. That is where the 0 to 255 range comes from. And 192 is 128 + 64, so 192 in binary is 11000000. You will only ever need this for masks.

3. The mask is the important part

Put the address and the mask on top of each other:

IP:    172 . 16  . 40  . 9
Mask:  255 . 255 . 255 . 0
       -----------------  ---
            NETWORK       HOST

Read 255 as "this whole octet is network" and 0 as "this whole octet is host." So the network is 172.16.40 and the host is 9.

4. What /24 means

Writing 255.255.255.0 every time is tedious, so we count the network bits instead. Three octets of 255 is three octets of ones: 8 + 8 + 8 = 24 ones. That is /24, called CIDR notation.

CIDR   Mask                  In binary
/8     255.0.0.0             11111111.00000000.00000000.00000000
/16    255.255.0.0           11111111.11111111.00000000.00000000
/24    255.255.255.0         11111111.11111111.11111111.00000000
/32    255.255.255.255       all ones: one single host

5. Where it gets interesting: /27

Now you see 255.255.255.224. The first three octets are 8 + 8 + 8 = 24 bits. The last octet, 224, is not all ones and not all zeros. In binary 224 is 11100000: three ones, five zeros. So 24 + 3 = /27.

You do not need to do binary each time. Memorize the eight values a mask octet can be, and how many ones each one holds:

Mask octet   Binary       Network bits in that octet
128          10000000     1
192          11000000     2
224          11100000     3
240          11110000     4
248          11111000     5
252          11111100     6
254          11111110     7
255          11111111     8

Try 255.255.240.0: 8 + 8 + 4 + 0 = /20. Try /29: 8 + 8 + 8 = 24, three left over, three ones is 224... no, five ones is 248. So /29 is 255.255.255.248.

6. The part that usually confuses people: which network is a host on?

Take 192.168.10.70/27. The mask is 255.255.255.224. The interesting octet is the one that is not 255 or 0: the last one, 224. The block size is 256 minus 224 = 32. That means networks start every 32 addresses:

.0   .32   .64   .96   .128   .160   .192   .224

Where does 70 fall? Between 64 and 96. So the network is 192.168.10.64, the next network starts at .96, and the last address in ours is .95.

192.168.10.64    network address (first address, never assigned)
192.168.10.65    first usable host
...
192.168.10.94    last usable host
192.168.10.95    broadcast address (last address, never assigned)

That is 30 usable hosts: 32 addresses in the block minus the two you cannot use.

7. Why you cannot use the first and last address

The first address of every subnet, with all host bits zero, is the network address. It names the whole subnet in routing tables. The last address, with all host bits one, is the broadcast address. Sending to it reaches every host in the subnet. Everything in between is yours to assign.

8. The historical classes

Before masks were flexible, the first octet decided the mask. The exam still expects you to recognize the ranges. Look only at the first number:

Class   First octet   Default mask        Example
A       1 to 126      /8   255.0.0.0      10.50.20.7      (10 = network, 50.20.7 = host)
B       128 to 191    /16  255.255.0.0    172.16.40.9     (172.16 = network, 40.9 = host)
C       192 to 223    /24  255.255.255.0  192.168.1.50    (192.168.1 = network, 50 = host)
D       224 to 239    multicast, never assigned to a host
E       240 to 255    experimental

Why is 127 missing? Because 127.0.0.0/8 is reserved for loopback. 127.0.0.1 always means "this computer." Pinging it tests your own TCP/IP stack and nothing else.

9. Class versus CIDR: the thing to get straight

Classful addressing is obsolete. Modern networks use CIDR, which means any prefix length is allowed on any address. So 192.168.1.50/26 is perfectly valid even though 192 is "Class C." The class tells you the historical default. The CIDR prefix tells you what the network actually uses. When a question gives you a prefix or mask, use it. When it only gives you an address and asks for the class or the default mask, use the first octet.

10. The big picture, in order

  1. Every IPv4 address is 32 bits: four octets of 8 bits, each 0 to 255.
  2. The mask splits those bits into network and host. 1 means network, 0 means host.
  3. CIDR counts the network bits: /24 is 24 ones.
  4. A partial mask octet is one of 128, 192, 224, 240, 248, 252, 254, 255, holding 1 to 8 ones.
  5. Block size is 256 minus the interesting mask octet; networks start at multiples of it.
  6. First address is the network, last is the broadcast, everything between is usable.
  7. Class A 1 to 126, B 128 to 191, C 192 to 223, D multicast, E experimental, 127 loopback.
The lesson after next teaches the block-size method in full. Once you can look at 192.168.50.137/26 and say the network, broadcast, and usable range in ten seconds, IPv4 stops being confusing.