So, Let’s talk about **Network, Subnet, and CIDR.**

## Knowledge of Computer Networking Service

What is networking technology? Networking computer science is a wide and main concept because without networking we can’t communicate with each other. AWS has a service with the name of VPC, Azure has a VNET service. There is a formula to calculate the IPs, Subnets, Networks, etc. Computer networking service always calculates in between 0 to 32 bits. So just always remember the formula, and you can calculate the values easily. An IP address is a thirty-two-bit binary number. The thirty-two bits are separated into four groups of eight bits called octets. However, an IP address is represented as a dotted-decimal number (for example 105.108.102.1). So, we will discuss about network classes.

Network has five different classes:- A Class = 0.0.0.0 to 127.255.255.255 B Class = 128.0.0.0 to 191.255.255.255 C Class = 192.0.0.0 to 223.255.255.255 D Class = 224.0.0.0 to 239.255.255.255 E Class = 240.0.0.0 to 255.255.255.255

**How we calculate bits?**

“0.0.0.0” in this each dot has 0 to 8 bits, and the maximum sum of all bits is 32. There is a formula “bit is the power of 2″ for example we have power of 2 is 8 then the calculation is ” 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 = 256″. So, in this situation we have to understand where we need to minus or plus the bits, only in one case we need to calculate the plus bits when we need to check “How many types of networks we can create”.

for example:-

cidr range = 10.0.0.0/24

calculate no. of available IPs = (total bits – current bits) power of 2

so total bits is 32 and current bits is 24 = 32 – 24 = 8 (is the power of 2)

Total no. of Hosts = 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 = 256

Number of Usable Hosts = Total Hosts – 2 = 256 – 2 = 254 (Total IPs of Subnet)

Second Example

CIDR Range = 10.0.0.0/18

calculate no. of available IPs = (total bits – current bits) power of 2

so total bits is 32 and current bits is 24 = 32 – 18 = 14 (is the power of 2)

No. of Available IPs = 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 = 16,384

No of Usable IPs = total IPs – 2 = 16,382 – 2 = 16,382

Note:- In the last calculation we subtract two IP’s, but we don’t know why we did that, which means there are two valid hosts in the subnet. The 2 we subtract in the formula one is stand for the network ID and the other one is broadcast ID.

**What is subnetting?**

Subnetting is taking an IP network and subdividing it into smaller IP networks called subnetworks, or subnets. Every IP network, or subnet, is a broadcast domain. A broadcast domain is a collection of devices that can receive broadcast traffic from each other. Broadcast traffic is traffic that is delivered to every device on the network.

**How many subnets we can create?**

We can create subnets as much as we have IPs, for example, we have 256 IPs so in that case, we can create 1 to 256 subnets.

**How we can know the available Hosts in a subnet?**

for example, we have one subnet 10.10.10.0/22

So in that case, we have current bits are 22 and the total bits are always fixed as 32.

Available Hosts = (total bits – current bits) power of 2

Total no. of Available Hosts = (32 – 22) power of 2 = 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 = 1024

Number of Usable Hosts = 1024 – 2 = 1022

**How to calculate the numbers of possible networks?**

So let us take one CIDR range 10.10.10.0/18, Now we are calculating the number of possible networks, and we can select anyone for our use. In this, we need to understand the increased bits.

we have total bits are 32 example ( 8 + 8 + 8 + 8).

and we have a range of 10.10.10.0/18. So in this, we have 2 increased bits. Just we need to focus on the prefix like (0-8), (9-16), (17-24), (25-32).

Prefix | /1, /9, /17, /25 | /2, /10, /18, /26 | /3, /11, /19, /27 | /4, /12, /20, /28 | /5, /13, /21, /29 | /6, /14, /22, /30 | /7, /15, /23, /31 | /8, /16, /24, /32 |

Possible network | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 0 |

Through the above table, we will try to understand the calculations for example:-

Blocked Bits = 8, 16, 24, 32

Increased Bits = Current Bits – Least lower blocked bits

example = 18 – 16 = 2 ( because the current bit is 18 and the least lower blocked bit of 18 is 16.)

example 2 = 15 – 8 = 7 (because the current bit is 15 and the least lower blocked bit of 15 is 8.)

Possible network = Increased bit is the power of 2.

Example:-

CIDR range = 10.10.10.0/18

increased bits = 18 – 16 = 2

Possible networks = 2 X 2 = 4

Network Address | Usable Host Range | Broadcast Address: |

10.10.0.0 | 10.10.0.1 – 10.10.63.254 | 10.10.63.255 |

10.10.64.0 | 10.10.64.1 – 10.10.127.254 | 10.10.127.255 |

10.10.128.0 | 10.10.128.1 – 10.10.191.254 | 10.10.191.255 |

10.10.192.0 | 10.10.192.1 – 10.10.255.254 | 10.10.255.255 |

I hope you understand the basics of computer networking service. So today we learned the basics of networking computer science.