Wednesday, June 22, 2011

IP Address Class A, B and C Network and Host Capacities

I introduced the concepts of IP address classes and showed how the classes related to ranges of IP addresses. Of the five classes, D and E are dedicated to special purposes, so I will leave those alone for now. Classes A, B and C are the ones actually assigned for normal (unicast) addressing purposes on IP inter networks, and therefore the primary focus of our continued attention.
 
As we've seen, they differ in the number of bits (and octets) used for the network ID compared to the host ID. The number of different networks possible in each class is a function of the number of bits assigned to the network ID, and likewise, the number of hosts possible in each network depends on the number of bits provided for the host ID. We must also take into account the fact that one, two or three of the bits in the IP address is used to indicate the class itself, so it is effectively "excluded" from use in determining the number of networks (though again, it is still part of the network ID).

Let's walk through one line of this table so we can see how it works. I'll stick with class B since it's "in the middle". The basic division is into 16 bits for network ID and 16 bits for host ID. However, the first two bits of all class B addresses must be "10”, so that leaves only 14 bits to uniquely identify the network ID. This gives us a total of 214 or 16,384 class B network IDs. For each of these, we have 216 host IDs, less two, for a total of 65,534.
Why less two? For each network ID, two host IDs cannot be used: the host ID with all zeroes and the ID with all ones. These are addresses with "special meanings" as described in the topic that follows. You will also notice that 2 has been subtracted from the number of network IDs for class A. This is because two of the class A network IDs (0 and 127) are reserved. There are actually several other address ranges that are set aside in all three of the classes that I haven't shown here. They are listed in the topic on reserved, private and loopback addresses

How to Find Network ID? 

Formula for Class A = 2^n-1
Formula for Class B = 2^n-2
Formula for Class C = 2^n-3
where n = CIDR for the class of IP Adddress.
CIDR = sum of bit of the IP Address class.
Example for class A :-

2 ^8-1 = 2 ^7
            = 126

Example for class B :-

 2 ^16-2 = 2 ^14
               = 16,384

Example for class C :-

2 ^24-3 = 2 ^21
              = 2,097,152

How To Find Host ID?

Formula for Class A = 2^n-2
Formula for Class B = 2^n-2
Formula for Class C = 2^n-2

where n = number of balance of the bit minus CIDR for the class of IP Adddress. ( example for class A = 32-8 ; where 32 is total sum of the bit of ip address and 8 is a sum of bit for class A )
CIDR = sum of bit of the IP Address class.

Example for class A :-

2 ^32-8 = 2 ^24
              = 16, 277, 214 - 2
              = 16, 277, 212

Example for class B :-

 2 ^32-16 = 2 ^16
                 = 65,534 - 2
                 = 65,532

Example for class C :-

2 ^32-24 = 2 ^8
                = 254 - 2
                = 252

No comments:

Post a Comment