Everything in networking is based on bits β bytes β IP
What is a BIT?
π A bit is the smallest unit of data
bit = 0 or 1
- 0 = OFF
- 1 = ON
What is a BYTE?
π A byte = 8 bits
1 byte = 8 bits
Example:
10101010 β 1 byte
What is an OCTET?
π An octet = 8 bits (same as byte)
In networking, we say:
- byte β general computing
- octet β networking (IP addresses)
π― KEY IDEA
1 octet = 8 bits = numbers from 0 to 255
π 2. Why 0β255?
Because:
2^8 = 256
π So:
0 to 255 = 256 values
π 3. Structure of IP Address
Example:
192.168.1.10
This has 4 octets:
[192] [168] [1] [10]
Each one = 8 bits
Total:
4 Γ 8 = 32 bits
π 4. The βBOX METHODβ (This is what you asked)
This is how you convert numbers like 192 into bits
Step 1 β Draw boxes
Each octet has 8 boxes (bits)
128 64 32 16 8 4 2 1
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]
π These numbers are powers of 2
π 5. Example: Convert 192
We need to make 192 using these numbers
Step-by-step:
192 - 128 = 64 β use 128 β put 1
64 - 64 = 0 β use 64 β put 1
Remaining = 0 β rest are 0
Final boxes:
128 64 32 16 8 4 2 1
1 1 0 0 0 0 0 0
Final answer:
192 = 11000000
π 6. Example: Convert 168
Step-by-step:
168 - 128 = 40 β 1
40 - 32 = 8 β 1
8 - 8 = 0 β 1
Boxes:
128 64 32 16 8 4 2 1
1 0 1 0 1 0 0 0
Final:
168 = 10101000
π 7. Example: Convert 1
00000001
π 8. Example: Convert 0
00000000
π 9. Full IP in Binary
192.168.1.10 =
11000000.10101000.00000001.00001010
π 10. VERY SIMPLE MEMORY TRICK
π Think:
Big numbers β left side
Small numbers β right side
π 11. Shortcut Table (Memorize This)
| Decimal | Binary |
|---|---|
| 128 | 10000000 |
| 192 | 11000000 |
| 224 | 11100000 |
| 240 | 11110000 |
| 248 | 11111000 |
| 252 | 11111100 |
| 255 | 11111111 |
π These are used in subnet masks
π 12. Why This Matters
You need this to understand:
- subnet mask
- network vs host
- AWS VPC
- CIDR
π FINAL SUMMARY
π bit = 0 or 1
π 8 bits = 1 byte = 1 octet
π octet = 0β255
π IP = 4 octets = 32 bits
π boxes = powers of 2
π fill with 1s to reach number
Top comments (0)