Subnetting
Binary Basics
- Binary uses only two values: 0 or 1
- Each bit represents a single binary value (0 or 1)
Bit and Byte
- 1 bit = 0 or 1
- 1 byte = 8 bits
- 1 octet = 1 byte = 8 bits
In networking, we usually say octet instead of byte because an IPv4 address always uses 8-bit groupings.
IPv4 Addresses and Decimal vs Binary
An IPv4 address is: 192.168.1.165
- 32 bits total
- Written as 4 octets
- Each octet = 8 bits
- Each octet is shown in decimal (base 10), but computers work in binary (base 2)
To truly understand an IP address, we convert each decimal octet into binary.
Decimal to Binary Conversion (One Octet)
Each octet uses 8 binary place values:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|
You determine whether each value is used (1) or not used (0).
Rule:
- Put 1 if you use that value
- Put 0 if you don’t
- The values you choose must add up to the decimal number
Convert Each Octet to Binary
1) Convert 192 to Binary
192 = 128 + 64
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
192 = 11000000
2) Convert 168 to Binary
168 = 128 + 32 + 8
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 |
168 = 10101000
3) Convert 1 to Binary
1 = 1
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
1 = 00000001
4) Convert 165 to Binary
165 = 128 + 32 + 4 + 1
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
165 = 10100101
Final Answer (Full IPv4 in Binary):
| 11000000. | 10101000. | 00000001. | 10100101 |
|---|---|---|---|
| 192. | 168. | 1. | 165 |
Key Notes
- Each octet is 8 bits, so it has 256 possible values
- That’s why each octet ranges from:
- 0 to 255 (because 2^8 = 256 values)
| Host Bits | Total Addresses | Usable Devices |
|---|---|---|
| 1 | 2 | 0 |
| 2 | 4 | 2 |