Network Kings

LIMITED TIME OFFER

$999 $499 only For All Access Pass Today! USE PROMO CODE : LIMITED

d :
h :
m

Subnetting in Computer Network: Explained 

subnetting in computer network
subnetting in computer network

Before starting subnetting in computer network, let us grab some important concepts required for it.  

Conversion from Binary to Decimal 

Let us first understand how to convert a binary number into a decimal  

  • Convert 10011011 into decimal   

27 

26 

25 

24 

23 

22 

21 

20 

128 

64 

32 

16 

8 

4 

2 

1 

1 

0 

0 

1 

1 

0 

1 

1 

  • On multiplying each column of the 2nd and 3rd row we get the following result 

128 

0 

0 

16 

8 

0 

2 

1 

= 155 

  • Now, on adding up each digit, we get a total of 155  

Hence 10011011 in binary format can also be written 155 as a decimal.  

Class 

Range 

Subnet Mask 

Default CIDR 

Class A 

0-127 

255.0.0.0 

/8 

Class B 

128-191 

255.255.0.0 

/16 

Class C 

192-223 

255.255.255.0 

/24 

Class D 

224-239 

N/A 

 

Class E 

240-255 

N/A 

 

Class A Format: – network.node.node.node  

Class B format: – network.network.node.node  

Class C format: – network.network.network.node  

We all are familiar with the above ranges of IP Addresses for every class, but how does this range get defined? 

  • The first bit of the first byte in a Class A network address is always off i.e., 0   

000000 = 0  

0111111 = 127  

Thus, class A Addresses will always be between 0 and 127   

  • The first bit of the 1st byte is always on, but 2nd bit is always off. When we turn all the other 6 bits off and then ON, we get the range for class B  

10000000 = 128  

10111111 = 191  

  • The first 2 bits of the first octet are always on, but 3rd bit is always off.  

11000000 = 192  

11011111 = 223  

What is Subnetting in computer networks?

We have already understood the IP Address and its types. We know the networks for different ranges of IP Addresses. What if we want to divide a particular range of IP Addresses into two or more categories?    

That can be done with the help of subnetting. So subnetting is a process of dividing a large network into the required number of networks.   

Before digging deep into how subnetting gets done, we need to understand why the concept of subnetting is mandatory in the first place. 

Why is Subnetting required?

Suppose a company had more than 254 hosts (say 315 hosts); Class C cannot fulfil the requirement. Hence the company would be purchasing the Class B network. But Class B can provide IP Addresses to 65,534 different hosts at the same time. Hence, there is a waste of IPs.   

Also, managing this large number of IPs is not an easy task for the network administrator. Thus, with the help of subnetting, a Class of IP Addresses can be divided into smaller parts according to the requirement, and each part of the network can get allocated to different companies, which ultimately reduces the wastage of IP. 

What are the benefits of using subnetting in computer networks?

Along with the reduced wastage of IP, we also get the following benefits by using subnetting-  

  • Network Traffic: Since we divided the network into smaller parts, network traffic reduces, and hence network congestion takes place. 
  • Optimized performance: Since network traffic gets reduced, network performance will increase.  

This process is also known as CIDR (Classless Interdomain Routing) and is used by ISP to allocate certain required block sizes to companies or customers, to home network gateways.  

If you get 192.168.10.32/28, that means you have 28 network bits and the remaining host bits are 4 (32 – 28= 4). 

So basically, a network is subnetted to /28 subnets.  

NOTE:/ Denotes the number of network bits.

How is subnetting done?

Let us take an example of IP Address 200.10.20.0/24, a class C IP Address, which is a total of 256 IPs and 254 usable IPs.  

The total of IPs is easily calculated using – 2(Total Bits – Network Bits).  

Hence, 32 – 24 = 8 and 28 = 256  

Total usable IPs = Total IP – 2, which implies 256 – 2 = 254.  

Let’s divide this network into two parts: –    

Since we know that the first three octets of class C are network Bits, and hence, we cannot change it, or the whole network will change. Therefore, to do the subnetting, we will use host bits.  

200.10.20. 00000000 (Host bits written in Binary 

To divide this network equally into two parts, we will fix the first bit of the host, and we know that bits are 0 and 1. The first bit can be fixed as 0 and 1.  

Hence it will look like this: –  

200.10.20.00000000 (S1) and 200.10.20.10000000 (S2)  

The remaining 7 bits of the host can either be 1 or 0.   

Subnet 1 

200.10.20.00000000, 200.10.20.00000001, 200.10.20.00000011, …. up to 200.10.20.01111111    

Hence the range of Subnet 1 is: – 200.10.20.0/25 to 200.10.20.127/25. 

Initially, the address range was 200.10.20.0/24 to 200.10.20.256/24. 

Network IP – 200.10.20.0  

Broadcast address – 200.10.20.127  

Total hosts – 128  

Usable Host – 128 – 2 = 126  

Subnet 2:  

200.10.20.10000000, 200.10.20.10000001, 200.10.20.10000011, …… upto 200.10.20.11111111   

Hence the range of Subnet 2 is: – 200.10.20.128/25 to 200.10.20.255/25. 

Network IP – 200.10.20.128  

Broadcast address – 200.10.20.255  

Total hosts – 128  

Usable Host – 128 – 2 = 126  

NOTE: The network IP for S1 is 200.10.20.0 and Broadcast IP for S2 is 200.10.20.255. 

Have you realized that the Network IP and Broadcast IP for our initial IP Address, i.e., 200.10.20.0/24 are also the same? Why? 

The default gateway router does not know about the subnetting, as we have discussed that subnetting is done inside the organization. We introduce one more router (on which subnetting is done) connected to the default gateway and help to route the packet to the particular subnet.  

Suppose the Destination address for a packet is 200.10.20.18, Default gateway will route this packet to the internal router. Internal Router knows the subnet mask and hence routes this packet to S1. Similarly, if the destination address is 200.10.20.130, the internal router will route the packet to S2.

What is a Variable length Subnet Mask (VLSM)?

So, we have understood how to divide a subnet into two equal parts, but what if we have three departments? 

  • The Academics Department requires a minimum of 100 hosts.  
  • The Sports Department requires a minimum of 50 hosts.  
  • Exam Department required a minimum of 50 hosts.  

Dividing a network with varying sizes of the host is known as Variable Length Subnet Mask.  

There is not much difference in the process of dividing the host into varying sizes.  

IP Address: – 200.10.20.0/24  

Let us divide the above network into three parts with a minimum of 100,50 and 50 hosts each.    

The process is simple. First, we will divide it into two parts as before, and then again divide S2 into two parts.  

200.10.20.00000000 (S1) and 200.10.20.10000000 (S2)  

We reserve one more bit of S2 and hence: –  

S2: – 200.10.20.10000000   S3: – 200.10.20.11000000  

Subnet 2 

200.10.20.10000000, 200.10.20.10000001, …… up to 200.10.20.10111111  

Hence the range of Subnet 2 in Binary is – 200.10.20.128 to 200.10.20.191. 

Network IP: – 200.10.20.128/26  

Broadcast address – 200.10.20.191/26  

Total hosts – 64  

Usable Host: – 64 – 2 = 62  

Subnet 3: 

200.10.20.11000000, 200.10.20.11000001, ……up to 200.10.20.11111111  

Hence the range of Subnet 2 in Binary is 200.10.20.192 to 200.10.20.255.  

Network IP: – 200.10.20.192/26  

Broadcast address – 200.10.20.255/26  

Total hosts – 64  

Usable Host: – 64 – 2 = 62  

If the concept of subnetting is not introduced in computer networking, we would be using different class C networks and 256 IPs for each department leading to the wastage of a lot of IPs.