Friday, June 1, 2007

IP Addressing

IP address is short for Internet Protocol address. An IP address is a unique address used to identify a device on an IP network. An IP address consists of 32 bits of information & these bits are divided into four octets or bytes. Each octet is separated by a period (dot). An IP address can be expressed using one of following methods

i. Dotted decimal format (for example, 192.168.1.1)
ii. Binary (for example, 11000000.10101000.00000001.00000001)

The value in each octet ranges from 0 to 255 in decimal, or 00000000 - 11111111 in binary.

The following example shows how to convert binary octets to decimal. The right most bit, or least significant bit, of an octet will hold a value of 20. The bit just to the left of that will hold a value of 21. This continues until the left-most bit, or most significant bit, which will hold a value of 27. So if all binary bits are a one, the decimal equivalent would be 255 as shown

  1  1  1  1 1 1 1 1 
128 64 32 16 8 4 2 1
(128+64+32+16+8+4+2+1=255)
An IP address can be divided into a network portion and host portion. The network address uniquely identifies each network & the node address or host address uniquely identifies each machine on a network.

There are five different classes of networks, A, B, C, D and E. Given an IP address, its class can be determined from the three high-order bits. The terms Class A, B etc are rarely used in the industry since the introduction of Classless Inter Domain Rouing(CIDR).

Class A:
The first bit of the first octet in a Class A network address must always be 0. This means a Class A address must be between 0 and 127.

Consider the following network address:

0xxxxxxx
If we turn the other 7 bits all off and then turn them all on, we’ll find the Class A range of network addresses:

00000000 = 0
01111111 = 127

So, Class A range of addresses falls between 1.0.0.0 and 127.255.255.255 (0 is not a valid class A network). In a Class A network address, the first byte is used to identify the network address and the remaining three bytes are used for the node addresses.

The Class A format is: network.host.host.host

For example in the IP address 10.12.22.30, 10 is the network address & 12.22.30 is the host address.

Class B:
The first bit of the first byte, in a Class B network must always be 1, but the second bit must always be 0. If you turn the other 6 bits all off and then all on, you will find the range for a Class B network:

10000000 = 128
10111111 = 191

So, Class B range of addresses falls between 128.0.0.0 and 191.255.255.255
In a Class B network address, the first two bytes are used to identify the network address and the remaining two bytes are used for the node addresses.

The Class B format is: network.network.host.host

For example in the IP address 172.16.22.56, 172.16 is the network address & 22.56 is the host address.

Class C:
The first 2 bits of the first octet in a Class C network must always be 1, but the third bit must always be 0. If you turn the other 5 bits all off and then all on, you will find the range for a Class B network:

11000000 = 192
11011111 = 223

So, Class C range of addresses falls between 192.0.0.0 and 223.255.255.255
In a Class B network address, the first two bytes are used identify the network address and the remaining two bytes are used for the node addresses.

The Class B format is: network.network.host.host

For example in the IP address 192.168.1.2, 192.168.1 is the network address & 2 is the host address.

Class D and E:
The addresses between 224 and 255 are reserved for Class D and E networks.
Class D addresses ranges from 224.0.0.0 to 239.255.255.255 which are used for multicast.
Class E addresses ranges from 240.255.255.255 to 254.255.255.255 which are used for scientific purposes.