IP addressing schemes
IP addressing schemes
An IP address is an address used to uniquely identify a device on an IP network. Every host and router on the Internet has an IP address, which encodes its network number and host number. The combination is unique: in principle, no two machines on the Internet have the same IP address. All IP addresses are 32 bits long and are used in the Source address and Destination address fields of IP packets. It is important to note that an IP address does not actually refer to a host. It really refers to a network interface, so if a host is on two networks, it must have two IP addresses. However, in practice, most hosts are on one network and thus have one IP address.
The address is made up of 32 binary bits which can be divisible into a network portion and host portion with the help of a subnet mask. The 32 binary bits are broken into four octets (1 octet = 8 bits). Each octet is converted to decimal and separated by a period (dot). For this reason, an IP address is said to be expressed in dotted decimal format (for example, 172.16.81.100). The value in each octet ranges from 0 to 255 decimal, or 00000000 − 11111111 binary.
Here is how binary octets convert to decimal: The right most bit, or least significant bit, of an octet holds a value of 20. The bit just to the left of that holds a value of 21. This continues until the left−most bit, or most significant bit, which holds a value of 27. So if all binary bits are a one, the decimal equivalent would be 255 as shown here:
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)
Here is a sample octet conversion when not all of the bits are set to 1.
0 1 0 0 0 0 0 1
0 64 0 0 0 0 0 1 (0+64+0+0+0+0+0+1=65)
And this is sample shows an IP address represented in both binary and decimal.
10. 1. 23. 19 (decimal)
00001010.00000001.00010111.00010011 (binary)
These octets are broken down to provide an addressing scheme that can accommodate large and small networks.
The IP address is a 32-bit address that consists of two components.
· One component is the network portion of the address, consisting of the network bits.
– The network bits make up the left portion of the address.
– They consist of the first bit up to some boundary, to be discussed later.
· The second component is the host portion of the address, consisting of the host bits.
– The host bits make up the right portion of the address.
– They consist of the remaining bits not included with the network bits.
IP Classes
The class of an address specified which of the bits were used to identify the network, the network ID, or which bits were used to identify the host ID, host computer. It also defined the total number of hosts subnets per network. There were five classes of IP addresses: classes A through E.
Classful addressing is no longer in common usage and has now been replaced with classless addressing. Any netmask can now be assigned to any IP address range.
The four octets that make up an IP address are conventionally represented by a, b, c, and d respectively. The following table shows how the octets are distributed in classes A, B, and C.
Class
|
IP Address
|
Network ID
|
Host ID
|
A
|
a.b.c.d
|
a
|
b.c.d
|
B
|
a.b.c.d
|
a.b
|
c.d
|
C
|
a.b.c.d
|
a.b.c
|
d |
Class A: Class A addresses are specified to networks with large number of total hosts. Class A allows for 126 networks by using the first octet for the network ID. The first bit in this octet, is always set and fixed to zero. And next seven bits in the octet is all set to one, which then complete network ID. The 24 bits in the remaining octets represent the hosts ID, allowing 126 networks and approximately 17 million hosts per network. Class A network number values begin at 1 and end at 127.
Class B: Class B addresses are specified to medium to large sized of networks. Class B allows for 16,384 networks by using the first two octets for the network ID. The two bits in the first octet are always set and fixed to 1 0. The remaining 6 bits, together with the next octet, complete network ID. The 16 bits in the third and fourth octet represent host ID, allowing for approximately 65,000 hosts per network. Class B network number values begin at 128 and end at 191.
Class C: Class C addresses are used in small local area networks (LANs). Class C allows for approximately 2 million networks by using the first three octets for the network ID. In class C address three bits are always set and fixed to 1 1 0. And in the first three octets 21 bits complete the total network ID. The 8 bits of the last octet represent the host ID allowing for 254 hosts per one network. Class C network number values begin at 192 and end at 223.
Class D and E: Classes D and E are not allocated to hosts. Class D addresses are used for multicasting, and class E addresses are not available for general use: they are reserved for future purposes.
Example 1:
Find the class of each address:
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 10100111 11011011 1000119011 01101111
d. 11110011 10011011 11111011 00001111
b. 11000001 10000011 00011011 11111111
c. 10100111 11011011 1000119011 01101111
d. 11110011 10011011 11111011 00001111
Solution:
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C address.
c. The first bit is 0; the second bit is 1. This is a class B address.
d. The first 4 bits are 1s. This is a class E address..
b. The first 2 bits are 1; the third bit is 0. This is a class C address.
c. The first bit is 0; the second bit is 1. This is a class B address.
d. The first 4 bits are 1s. This is a class E address..
Example 2:
Find the class of each address:
a. 227.12.14.87 b.193.14.56.22 c.14.23.120.8
d. 252.5.15.111 e.134.11.78.56
d. 252.5.15.111 e.134.11.78.56
Solution:
a. The first byte is 227 (between 224 and 239); the class is D.
b. The first byte is 193 (between 192 and 223); the class is C.
c. The first byte is 14 (between 0 and 127); the class is A.
d. The first byte is 252 (between 240 and 255); the class is E.
e. The first byte is 134 (between 128 and 191); the class is B.
b. The first byte is 193 (between 192 and 223); the class is C.
c. The first byte is 14 (between 0 and 127); the class is A.
d. The first byte is 252 (between 240 and 255); the class is E.
e. The first byte is 134 (between 128 and 191); the class is B.
Example 3:
Find the class and net ID for each address:
a. 14.23.120.8 b. 227.12.14.87 c. 134.11.78.56
Solution:
a. The first byte is 14 (between 0 and 127); the class is A & Net ID is 14.0.0.0
b. The first byte is 227 (between 224 and 239); the class is D & it is used for multicasting so it does not have any Net ID.
c. The first byte is 134 (between 128 and 191); the class is B & Net ID is 134.11.0.0
Example 4:
Find the class and Host ID for each address:
a. 14.23.120.8 b. 227.12.14.87 c. 134.11.78.56
Solution:
a. The first byte is 14 (between 0 and 127); the class is A & Host ID is 0.23.120.8
b. The first byte is 227 (between 224 and 239); the class is D & it is used for multicasting so it does not have any Host ID.
c. The first byte is 134 (between 128 and 191); the class is B & Host ID is 0.0.78.56