IPv4
An IPv4 address is composed of four sets of 8 binary bits, which are referred to as octets. The result is that IP addresses are 32 bits in length. Each bit in each octet is assigned a decimal value. The leftmost bit has a value of 128, followed by 64, 32, 16, 8, 4, 2, and 1, left to right.
Each bit in the octet can be either a 1 or a 0. If the value is 1, it is counted as its decimal value, and if it is 0, it is ignored. If all the bits are 0, the value of the octet is 0. If all the bits in the octet are 1, the value is 255, which is 128+64+32+16+8+4+2+1.
By using the set of 8 bits and manipulating the 1s and 0s, you can obtain any value between 0 and 255 for each octet.
Table 1 shows some examples of decimal-to-binary value conversions.
|
Decimal Value |
Binary Value |
Decimal Calculation |
|---|---|---|
|
10 |
00001010 |
8+2=10 |
|
192 |
11000000 |
128+64=192 |
|
205 |
11001101 |
128+64+8+4+1=205 |
|
223 |
11011111 |
128+64+16+8+4+2+1=223 |