How do we determine the class of the IP address?

solti picture solti · Dec 13, 2015 · Viewed 7.5k times · Source

I am currently trying to understand the IP address's class. I came across two ways to determine the class of IP address:

1) Format (eg. N.H.H.H = class A, N.N.H.H = class B)

2) bits in the beginning of the IP address ( eg. 0xxx.xxxx.xxxx = class A)

Is the identification of class of IP determined by 1 && 2 (by this I mean satisfy rule 1 and 2) rule or 1 || 2( by this I mean satisfy rule 1 or 2)?

For 128.138.243.100/26

Address:   128.138.243.100       10000000.10001010.11110011.01 100100
Netmask:   255.255.255.192 = 26  11111111.11111111.11111111.11 000000
Wildcard:  0.0.0.63              00000000.00000000.00000000.00 111111
=>
Network:   128.138.243.64/26     **10**000000.10001010.11110011.01 000000 (Class B)
Broadcast: 128.138.243.127       10000000.10001010.11110011.01 111111
HostMin:   128.138.243.65        10000000.10001010.11110011.01 000001
HostMax:   128.138.243.126       10000000.10001010.11110011.01 111110  
Hosts/Net: 62                    

How could 128.138.243.100/26 be class B if we flow rule 1. Since rule 1 says class B should be N.N.H.H but in the above example clearly the N part of the IP address is beyond N.N.N.(here it even encroaches two bit of the H ).

Answer

Ron Maupin picture Ron Maupin · Dec 13, 2015

Understand that RFCs have obsoleted classes, so there really aren't any classes anymore, but they are still referred to historically.

The class of an IP address is determined by the starting bits of the address:

  • Starts with 0, it is a Class A
  • Starts with 10, it is a Class B
  • Starts with 110, it is a class C
  • Starts with 1110, it is a class D
  • Starts with 1111, it is a Class E

In your example, the address is a Class B because of the starting bits, but it is in a subnet of the Class B network.

128.138.243.100/26 is:

       |     NETWORK     |   SUBNET  | HOST |
Address 10000000.10001010.11110011.01 100100
Mask    11111111.11111111.11111111.11 000000