Four numbers, 32 bits
An IPv4 address such as 192.168.1.77 is really a 32-bit number. We write it as four decimal numbers, each standing for 8 bits (one octet), so each part is between 0 and 255.
The only table you need
Each bit in an octet has a value. Add up the values of the bits that are 1:
| Bit value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| 192 = | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| 168 = | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 |
| 77 = | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 255 = | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
So 168 = 128 + 32 + 8, and 77 = 64 + 8 + 4 + 1.
Decimal to binary
Go left to right: if the number is at least the bit value, write 1 and subtract it; otherwise write 0. For 200: 200 ≥ 128 → 1 (72 left); 72 ≥ 64 → 1 (8 left); 32 → 0; 16 → 0; 8 → 1 (0 left); then 0, 0, 0. Answer: 11001000.
Network part and host part
Every address has two parts. The first bits say which network the device is on (like a street name); the remaining bits say which host it is on that network (like a house number). The subnet mask, coming next, marks where one part ends and the other begins.
Think of it like this: All PCs in one LAN share the same network part, just as all houses on one street share the street name. The router only needs to know the street to deliver the post.
Tip: You will get faster with practice. Write the 128-64-32-16-8-4-2-1 row at the top of your scrap paper in the exam before you start.