Classful IP Addressing
In classful IP addressing, there are five classes, which are given below
In each class, two host IPs are reserved
- First host-IP in the network which is zero (i.e. for class A (1.0.0.0) represents to that network and cannot be assign to any host in the network.
- The last IP in the network (i.e., for class A (126.255.255.255) is used for broadcasting.
In each class, Some Leading Bits are reserved For Class Identification
- For class A, The first leading bit is always fixed to “0.”
- The first two leading bits for class B are always set to “10.”
- Class C’s first three leading bits are always fixed to “110.”
- Class D’s first four leading bits are always fixed to “1110.”
- For class E, The first four leading bits are always fixed to “1111.”
Look at the following diagram for better understanding
The number of networks and number of hosts in each class can be calculated through the following formula
Important: To find the Subnet mask of each class, Replace all Host octets to Zero and Network Octets to 255.
Class A
- The first octet (8 bits) represents the network ID, and the remaining 3 octets (24 bits) represent the host ID. The first 1 leading bit of network ID in Class A is always (0), and the remaining 7 bits represent network ID.
- Format: 0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH (in binary)
- Start to End IP Address = (0.0.0.0 to 127.255.255.255)
- Value of first octet = 0 – 127
- Possible network ID’s = (27) = 128
Important Note: In class A, Network ID Zero (i.e., 0.0.0.0) is reserved for the default network, and Network ID 127 (i.e., 127.0.0.0) is reserved for loopback (used for software testing). So, the remaining 126 (1-126) network IDs are used in class A.
- Possible Hosts = (224-2) = 16777214
- Total number of possible IP addresses = (231) = 2,147,483,648 (because “1 out of 32” bit is leading bit)
- First IP address = 0.0.0.0
- First Host address = 0.0.0.1
- Last IP address = 127.255.255.255
- Last Host address = 127.255.255.254
- Subnet Mask = 255.0.0.0
Example
Note: Class A Network is used for large-size companies because it has a large number of hosts.
Class B
The first two octets (16 bits) represent the network ID, and the remaining 2-octets (16 bits) represent the host ID. The first two leading bits of network ID in Class B are always (10), and the remaining 14 bits represent network ID.
- Format: 10NNNNNN. NNNNNNNN.HHHHHHHH.HHHHHHHH (in binary)
- Start to End Address IP addresses = (128.0.0.0 to 191.255.255.255)
- Value of first octet = (10000000 – 10111111) = 128 – 191
- Possible network ID = (214) = 16384
- Possible Hosts = (216-2) = 65534
- Possible Total number of IP addresses = (230) = (2 out of 32 bit is leading bit)
- First IP address = 128.0.0.0
- First Host address = 128.0.0.1
- Last IP address = 191.255.255.255
- Last Host address = 191.255.255.254
- Subnet Mask = 255.255.0.0
Example:
Note: Class B Network is used for medium-sized companies because it has a small number of hosts as compared to class A.
Class C
The first three octets (24 bits) represent the network ID, and the remaining 1 octet (8 bits) represents the host ID. The first three leading bits of network ID in Class B are always (110), and the remaining 21 bits represent network ID.
- Format: 110NNNNN. NNNNNNNN. NNNNNNNN.HHHHHHHH (in binary)
- Start to End Address IP addresses = (192.0.0.0 to 223.255.255.255) (in hexadecimal)
- Value of first octet = (11000000 – 11011111) = 192 – 223
- Possible network ID = (221) = 2097152
- Possible Hosts = (28-2) = 254
- Possible Total number of IP addresses = (229) = (3 out of 32 bit is leading bit)
- First IP address =192.0.0.0
- First Host address = 192.0.0.1
- Last IP address = 223.255.255.255
- Last Host address = 223.255.255.254
- Subnet Mask = 255.255.2555.0
Example:
Note: Class C Network is used for small companies because it has a small number of hosts compared to classes A and B.
Class D
Class D is used for multicasts. Multicasting is used to pass the copies of the datagram to selected groups of hosts instead of individual hosts. Class D is slightly different from the first three classes.
The first four leading bits of network ID in Class D are always (1110), and the remaining 28 bits represent a group of computers where the multicast message will be passed.
- Format: 1110mmmm.mmmmmmmm.mmmmmmmm.mmmmmmmm (in binary)
- Start to End Address IP addresses = (224.0.0.0 to 247.255.255.255) (in hexadecimal)
- Value of first octet = (11100000 – 11101111) = 224 – 247
- Possible Total number of IP addresses = (228) = (4 out of 32 bit is leading bit)
- First IP address = 224.0.0.0
- First Host address = 224.0.0.1
- Last IP address = 239.255.255.255
- Last Host address = 223.255.255.254
- Subnet Mask, Network ID, and Host ID are not defined in Class D
Example
Class E
Class E is used for future Experimental purposes only. It is mostly used in research and development fields. The first four leading bits of network ID in Class E are always (1111)
- Format: 1111rrrr. rrrrrrrr. rrrrrrrr. rrrrrrrr (in binary)
- Start to End Address IP addresses = (248.0.0.0 to 255.255.255.255) (in hexadecimal)
- Value of first octet = (11110000 – 11111111) = 248 – 255)
- Possible Total number of IP addresses = (228) = (4 out of 32 bit is leading bit)
- First IP address = 240.0.0.0
- First Host address = 240.0.0.1
- Last IP address = 255.255.255.255
- Last Host address = 223.255.255.254
- Subnet Mask, Network ID, and Host ID are not defined in Class E
Example:
Descriptive Diagram of IP Classes 
Important Points
- In a single network, All hosts hold the same network ID but different Host IDs.
- Two hosts in different networks have different network IDs but may have the same host ID.
- The last Network ID (i.e., 255.255 in Class B) with the Last IP Address of that class (i.e., 255.255 in Class B) is always a limited broadcast address of that class. The limited broadcast address of any class will always = 255.255.255.2555.
- Any Network ID (i.e., 135.115 in class B) with its Last IP Address (i.e., 255.255 in class B) is always a direct broadcast address of that class. the direct broadcast address of Network ID 135.115 is = 135.115.255.2555.
Questions of Classful IP Addressing
The question is, if the given IP address = 201.20.31.65, then find out the following parts.
Part 1: Find the Class of the given IP.
Solution: The first Octet of the given IP address exists in between the range of Class C (192 – 223). So, the given IP belongs to class C.
Part 2: Find the Subnet Mask of the given IP.
Solution: After checking the class of the given IP. A subnet mask can be found by putting all octet-bits of network ID to “255” and Host bits to “0”. So, the Class C subnet mask is 255.255.255.0.
Part 3: Find the Network ID.
Solution: To find the network ID, Perform AND operation of the given IP with Subnet mask in binary. It will provide the network ID where that particular IP exists. So, the network ID will be 201.20.31.0.
Part 4: Find the First and Last IP address of the given Network IP.
Solution: We know that there are two IPs for each network, which are reserved. As the Network ID is 201.20.31.0. So, the first IP address will be 201.20.31.0, which is reserved for network identification. The last IP address is 201.20.31.255, which is reserved for direct broadcasting.
Part 5: Find the first and Last Host ID of the given Network IP.
Solution: Due to the reservation of two Hosts, the Network ID is 201.20.31.0. So, the first host IP address will be 201.20.31.1, and the Last host IP address will be 201.20.31.254.
Part 6: Find the Limited broadcast IP address.
Solution: Replacing all octets of IP address to 255 (decimal) is called Limited broadcast IP addressing. So, Limited broadcast address = 255.255.255.255.
Part 7: Find the Direct broadcast IP addressing.
Solution: Replacing the Host-bits-octets to 255 of a given IP is called direct broadcast IP addressing. So, direct broadcast IP addressing = 201.20.31.255.