IP Addresses are part of the daily routine for any system admin and to work properly we need to know how subnetting works. mostly of us are confused with subnetting. In this article, we basically focus on class C IP address subnetting. Before that a brief intro for our new engineers.
IP Address
The IP address is the main identifier of any system which is on any type of network. We can assign by using DHCP or static according to our requirements. It divides into 4 octets which decide which class of IP it is. Below are examples of IP address
192.168.4.1
10.122.1.9
170.28.29.54
There are 5 IP classes A, B, C, D, and E but mainly we use only A, B, and C. Apart from network engineering often we need to work on class C IP addresses for servers and devices.
From the above image, you can understand the classes of subnetting A, B, and C.
255.0.0.0 – 255.254.0.0 is class A
255.255.0.0 – 255.255.254.0 is class B
255.255.255.0 – 255.255.255.255 is class C
This is an easy way to understand which IP class you are using. This is an easy identifier of subnets but if you want to calculate in binary terms that we will see later in the article.
Related article: https://explinux.online/2020/05/learn-new-linux-tricks.html
Class A
Class A has the highest number of IP addresses and this has 16777216 usable IP addresses.
Class B
Class B has a lower usable IP address in this subnet mask you will get a 65534 IP address
Class C
This has only 254 usable IP address So managing via a network switch and physical servers are easy as compared to other classes where manual handling is required.
Subnet
Term subnet or subnetting of the subnet mask is used when we use part of any subnet. Like in class C we could have 254 maximum IP if we use CIDR /24 or Prefix 24 or NETMASK 255.255.255.0. But if we want a small section of IP then we can do subnetting of any subnet mask. For example, if we need only 16 IPs we can use CIDR /28 or Prefix 28, or NETMASK 255.255.255.240.
IP Size | Netmask | CIDR |
1 | 255.255.255.255 | /32 |
2 | 255.255.255.254 | /31 |
4 | 255.255.255.252 | /30 |
8 | 255.255.255.248 | /29 |
16 | 255.255.255.240 | /28 |
32 | 255.255.255.224 | /27 |
64 | 255.255.255.292 | /26 |
128 | 255.255.255.128 | /25 |
256 | 255.255.255.0 | /24 |
The above table is created for you to understand subnets and their use.
Understand Subnet Fundamental
A subnet mask is consist of 4 octets with the binary form which define the subnet mask. below is the standard to define a subnet mask. Octets mean a group of eight in simple terms. so we have 8 bits in each octet and 4 octets to create one subnet.
octet = 11111111 or 10100011 etc
Subnet = 11111111.111111111.11111111.11111111 = 255.255.255.255
How to solve it?
Hope you know the binary and decimal number systems. Below is a calculation of how we do the conversion from binary to decimal
11111111 = 1*27 +1*26 +1*25 +1*24 +1*23 + 1*22 + 1*21 +1*20 = 255
11111110 = 1*27 +1*26 +1*25 +1*24 +1*23 + 1*22 + 1*21 +0*20 = 254
11111000 = 1*27 +1*26 +1*25 +1*24 +1*23 + 0*22 + 0*21 +0*20 = 248
11100000 = 1*27 +1*26 +1*25 +0*24 +0*23 + 0*22 + 0*21 +0*20 = 224
Now this is a simple calculation we do to convert them into decimal form
255.255.255.255 = 1111111.11111111.11111111.11111111
255.255.0.0 = 11111111.11111111.00000000.00000000
This is how we calculate the subnet mask.
Subnet Mask vs subnetting
Sometimes we confusion about this term when we use a small amount of IP in a class of IP then it is called subnetting class c could have 254 usable IPs but if we need only 16 IPs we can use CIDR /28 or 255.255.255.240 then it is called subnetting. This could help you to avoid confusion when discussing with the network team.
In this article, we have covered an introduction to the subnet. Hope you find it useful. leave comments and share if helpful.