Networking

Subnetting (Basics)

subnetting · ipv4 · binary

Subnetting

Binary Basics

Bit and Byte

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

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:


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


| Host Bits | Total Addresses | Usable Devices | |--|--|--| |1|2|0| |2|4|2|