# 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.

Table 1 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

IP addresses are grouped into logical divisions called classes. In the IPv4 address space, there are five address classes (A through E), although only three (A, B, C) are used for assigning addresses to clients. Class D is reserved for multicast addressing, and Class E is reserved for future development.

Table 2 IPv4 Address Classes and the Number of Available Network/Host Addresses

Range

Number of Networks

Number of Hosts per Network

Binary Value of First Octet

A

1126

126

16,777,214

0xxxxxxx

B

128191

16384

65,534

10xxxxxx

C

192223

2,097,152

254

110xxxxx

D

224239

NA

NA

1110xxxx

E

240255

NA

NA

1111xxxx