An IP address is a network layer (Layer 3) address that uniquely identifies a host, including network components and devices, on a TCP/IP network. An IP address is composed of 32 binary bits and consists of two parts: a network ID and a host ID.
. The Network ID identifies the TCP/IP hosts that are located on the same physical network. All hosts on the same physical network must be assigned the same network ID to communicate with each other. If routers connect your networks, a unique network ID is required for each wide area connection.
. The Host ID identifies the individual hosts within a network. The host ID must be unique to the network designated by the network ID.The boundary between the network ID and the host ID of the IP address is defined by the subnet mask, which is another 32-bit field. There is a bit-for-bit alignment between the IP address and the subnet mask. The subnet mask contains a continuous field of 1s followed by a continuous field of 0s. The contiguous 1s stop at the boundary between the network ID and the host ID of the IP address. The network boundary can occur at any place after the eighth bit position from the left. Once the boundary between the network part and the host part of the IP address is known, all devices addressed in that network will have a common binary pattern in the network part that identifies the device as belonging to the specified network. There are a number of formats for referencing an IP address. These include binary, dotted decimal notation and Classless Interdomain Routing (CIDR) Notation.
Binary is a numeral system that is 2 based, i.e., it uses only 0s and 1s, to denote a value. Because binary is 2 based, each successive bit is twice the value of the preceding bit, read from right to left. This is illustrated in Appendix
A. A 0 denotes that the bit does not carry a value and a 1 denotes that the bit does carry a value. When binary value has more than one 1, as in 000001001 the decimal values for the 1s are added to produce the decimal value. In this example 000000001 is 1 and 000001000 is 8. Therefore the decimal value for 000001001 is 9 (8+1). The maximum binary value for an octet would contain all 1s, as in 111101111, and would have a decimal value 255 (128+64+32+16+8+4+2+1), as illustrated in Figure 3.1.
FIGURE 3.1: Binary Code 1111 1111
The decimal value of the binary code is the sum of decimal value of each bit. Therefore the decimal value for a binary code of 111101111 is 128+64+32+16+8+4+2+1=255
Note: The corresponding decimal value of the binary code is calculated from right to left and not left to right.
A 0 in the binary code indicates that the corresponding bit has no value. Figure 3.2 illustrates a byte with a binary code of 111001101 and the value of each of its eight bits.
FIGURE 3.2: Binary Code 1110 1101
The decimal value for this binary code is 128+64+32+0+8+4+0+1=237
Note: Each bit in the binary code that is marked with a 0 has no value. Therefore the corresponding decimal value of these bits are also 0.
Dotted Decimal Format
Both the IP address and its associated subnet mask contain 32 bits. However, the 32-bit IP address can be represented in other formats. The common formats include decimal (base 10) and hexadecimal (base 16) notation. The generally accepted format for representing IP addresses and subnet masks the doted decimal notation in which the 32-bit field is divided into four groups of eight bits, also called a byte, that are translated to decimal value and separated by dots. Each group of eight bits is called an octet. Thus, an IP Address expressed as 110000000010100100001010001100011101110 in binary format can be broken into its four octets: 110000000.101001000.101000110.011101110. These octets are converted to decimal value in Figure 3.3.
|First Octet||Binary Code||1||1||0||0||0||0||0||0|
|Second Octet||Binary Code||1||0||1||0||1||0||0||0|
|Third Octet||Binary Code||1||0||1||0||0||1||1||0|
|Fourth Octet||Binary Code||0||1||1||1||1||1||1||0|
FIGURE 3.3: Binary Code 1100 0000.1010 1000.0111 1011
The decimal value of the first octet is: 128+64+0+0+0+0+0+0 = 192
The decimal value of the second octet is: 128+0+32+0+8+0+0+0 = 168
The decimal value of the third octet is: 128+0+32+0+0+4+2+0 = 166
The decimal value of the fourth octet is: 0+64+32+16+8+4+2+0 = 126
In dotted decimal format this IP Address would be expressed as: 192.168.166.126