IPv4-Address Classes and IP Sub-netting

Madhaveeabayanayake
6 min readFeb 21, 2021

Hello everyone!

In this article we are going to learn about IPv4-address classes and IP sub-netting.

Address Classes in IPv4

The hierarchy of Internet Protocol is containing several group of IP addresses for each network to sufficient usage at different times, depending on the needs of the hosts. Broadly speaking, the IPv4 address system divides into five categories of IPs. All five classes are identified by the first octal IP address set. Assigning IP addresses to assigned names and numbers are the responsibilities of the Internet Corporation. The first octave set mentioned here is to the left most of all. Below are the octal numbers that represent the dot decimal number of the IP address.( figure 1.1)

(figure 1.1)

The following formula can be used to get the number of networks and the number of hosts per class;

no: of the networks = 2 ^ network_bits

no: of the Hosts / Network = 2 ^ host_bits -2

When calculating IP addresses of hosts, there are less than two IP addresses as they can’t be assigned to the hosts, i.e. the network number of the first IP of a network and the last IP is dropped to the broadcast IP.

Class A IP

The early bit in the first octave is always set to 0 (zero). So the first octave range may be from 1–127.

00000001 - 01111111

1–127

Addresses of class A, only hold IPs from 1.x.x.x. to 126.x.x.x. The IP range is reserved for 127.x.x.x. addresses of loopback IP. The default network coverage to a Class A IP address act as 255.0.0.0, which signifies that a Class A address may have 126 networks that (27–2) and hosts 16777214 (224 –2). Can identify this class IP address in this format;

0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH

Class B IP

A Class B IP is set to 10 in the first two bits of the first octave.

10000000 –10111111

128 –191

So, the range from 128.0.x.x to 191.255.x.x. assign for class B IP addresses. Class B Default Subnet covers 255.255.x.x. Class B holds16384 (214) network addresses as well as 65534 (216–2) host addresses. Format of class B IP address;

10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH

Class C IP

The early 3 bits in the first octet of the class C IP address are set to 110, i.e.;

11000000 –11000000

192 – 223

So, the range from 192.0.0.x. to 223.255.255.x. assign to class C IP addresses. Class C Default Subnet covers 255.255.255.x. Class C holds 254 (28–2) host addresses as well as 2097152 (221) network addresses. Class C IP Address can see in this format;

110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH

Class D IP

The early 4 bits in the first octave of the class D IP addresses set to 1110 and give a range of;

11100000 –11101111

224 – 239

Addresses range of class D, from 224.0.0.0 to 239.255.255.255. Also this is reserved for the multiple transmissions. In multimedia, data isn’t assigned to specific host, so there is no need to extract the host address from the IP address. As with Class D, there is no subnet cover.

Class E IP

This IP class is reserved only for the researches or studies. IP addresses of this category seems the range from 240.0.0.0. to 255.255.255.254. Class E, is not equipped with any subnet cover like class D.

Every class of IP is armed with its own default network cover, it means the IP classes must have a pre-configured number of networks and a number of pre-network hosts. Classic IP addresses don’t offer any flexibility to have a smaller number of hosts per network or more network size for IP classes.

Classless Inter-Domain Routing- CIDR is providing the flexibility to borrow bits of the IP address and use them as a subnet within the network. By using subnetworks, smaller subnets that provide better network management capabilities can use only a single class IP address.

So, let’s we learn about sub-netting.

Class A subnets

In Class A, only the early octet set is used as the network detector, the remaining 3 octets are assigned to the hosts (i.e., hosts 16777214 per network). The bits are borrowed from the host partition, and then the subnet mask is modified accordingly to create a higher class A subnet.

Let’s think, if one msb(most significant bit) is borrowed from the host bits of the second octet set, then added to the network address, it forms two subnets (21 = 2) with the host (223–2) 8388606.

Subnet covers vary as reflected in the subnet. The following is a list of all possible combinations of Class A subnet (Figure 1.2).

(figure 1.2)

In the case of subnetworks, the first and last IP address of each subnet is used for the subnet number as well as the broadcast IP address of the subnet. Because these two IP addresses cannot be assigned to hosts and subnetworks. Therefore, a subnet cannot be executed by using more than 30 bits as network bits that provide less than two hosts.

Class B subnets

By default, using classic addresses, 14 bits are used as network bits (214) for network 16384 as well as (216–2) 65534 for hosts. Class B IP addresses can be sub-netted in the similar way as class addresses via bits borrowed from host bits.

Class C subnets

Class C IP addresses are usually assigned to a very small network because it can only have 254 hosts per network.

ISPs (Internet Service Providers) may require different sizes of IP subnetworks depending on the customer’s needs. One client can request a Class C network with 3 IP addresses and another client can request 10 IPs. For ISPs, IP addresses cannot be subdivided into fixed-size subnets, instead they may need to network subnetworks, which would otherwise waste IP addresses.

let’s see this example;

An administration has a network of 192.168.1.0/24. Specifies the number of bits used for the network address / 24. In this example, the administration has three different faculties with different host numbers. The IT faculty has 100 computers, the Medical faculty has 50 computers, the Architecture faculty has 25 computers and the Management faculty has 5 computers. In CIDR, the subnets are of a fixed size and use the similar methodology and the administration cannot meet all the requirements of the network.

The following procedure shows how VLSM (Classless Inter-Domain Routing) can be used to allocate IP addresses according to the faculty as shown in the example.
Step 1: Create a list of possible subnets (Figure 1.3)

(figure 1.3)

Step 2 : Sort the IP addresses in descending order (top to bottom).

IT 100

Medical 50

Architecture 25

Management 5

Step 3 : Allocate the highest range IP for the highest requirements, so IT faculty can be assigned 192.168.1.0 / 25 (255.255.255.128). This IP subnet with network number 192.168.1.0 has 126 valid host IP addresses and meets the requirements of IT faculty. The subnet mask that used for this subnet is 10000000 as the final octave.

Step 4 : Allocate the next highest range, so we can assign 192.168.1.128 / 26 (255.255.255.192) to medical faculty. This IP subnet with network number 192.168.1.128 has 62 valid host IP addresses and can be easily assigned to all computers of medical faculty. These subnet masks used 11000000 in the last octave.

Step 5 : Allocate the next highest range for Architecture faculty. The requirements of 25 IPs can be met with the 192.168.1.192 / 27 (255.255.255.224) IP subnet, that contains 30 valid host IPs. The network number of the architecture faculty is 192.168.1.192. So the last octet of the subnet mask is 11100000.

Step 6 : Allocate the next highest range under Management faculty. There are only 5 computers in the Management faculty. The 192.168.1.224 / 29 subnet with the mask 255.255.255.248. has exactly 6 valid host IP addresses. So this can be assigned to management faculty. The final octave of the subnet cover contains 11111000.

Using VLSM, the administration can network the IP network in such a way as to minimize the number of IP addresses. In this example, there are plenty of IP addresses that could not be used in CIDR, even after assigning an IP to each utility and administration.

Okay !

That was it for sub-netting today! I hope this article was instructive and should you have any comments, do not hesitate to share them with me.

--

--

No responses yet