In the realm of the Internet, the word ‘subnet’ stands for sub-networking. It may give the impression that a subnet may be, somewhat, a small section of a network and it may be of a little importance as compared to a network. But the fact is something different and interesting! Let’s explore together!
The sphere of Networking in Computer Science & Technology embraces interconnections among computers, arrays of such interconnections, and a more extensive system of such networks. One of the worth mentioning attributes of this Networking is SUBNETs.
The art of setting up Subnets in a network calls for a clear understanding of the basics of IP addressing in the eon of the internet.
So we shall start here with some preliminary work, and subsequently dip down to understand the essence of Subnets and its application. The concept of subnetting applies to both IPv4, and IPv6 addresses.
Therefore, we shall first concentrate on the subnetting of IPv4 addresses and then deal with subnetting of IPv6 addresses.
Accordingly, our discussion will roll through the following headings
- What are the prerequisites to comprehend Subnets?
- Why do we need Subnets?
- What is a Subnet?
- How is Subnetting done?
- What is a Subnet mask?
- What are the advantages of Subnet and Subnet Mask?
- An intricate illustration of Subnetting
- How can we set up Subnets in IPv4, and IPv6 addresses?
- Challenge yourself
Let’s get started!
What are the prerequisites to comprehend Subnets?
As groundwork for subnets, we need to know IP addresses, its classes, and its interpretation in IPv4 and IPv6 environment.
An IP address which stands for Internet Protocol address is a globally distinct address for a network interface. It enables any piece of hardware to transfer, and receive data on the network layer.
In the light of Internet Protocol versions 4 & 6, an IP address manifests itself differently.
A 64bit IP address [IPv4] consists of the network ID [or extended network ID] for routing purposes and the host ID for the specific host identification. Again a 128bit IP address [IPv6] encompasses Global Routing Prefix, Subnet ID, an interface ID.
Why do we need Subnets?
Let us try to uncover the necessity of subnets with the help of an example. Take the instance of an office with its 500employees working in 10departments, housed in a 7storied building, and using 500computers, 70printers, and 30 plotters with different levels of access as per requirement, and approval. And all of these are in different floors of the building. Also, the network administrator has to give internet connection to these 500 computers along with selective interconnections among those 600 devices.
How do we accomplish interlinking in the backdrop of classful IP addressing?
In the background of classful IP addressing, the office scenario cited above, demands the following:
- Assigning of (500+70+30=) 600 individual IP addresses to computers, printers, and plotters,
- Connecting the 500 computers to the internet through departmental-wise separate 10networks.
These requirements, in turn, calls for
- Buying more individual address blocks to assign a separate network for each of the 10departments,
- Wasting a good percentage of IP addresses(host IDs) under each network ID,
- The increase of router table entries leading to the slow speed of data-transfer due to relatively long time for routing decisions,
- Connecting all of its devices to the public IP network without any inherent hierarchical flexibility.
How do Subnets figure out as a solution?
Addressing the above problems, RFC 950  brings in the improved addressing procedure termed Subnetting.
This method of IP addressing enables any organization described above or of any size, to sensibly utilize the network address space along with well structured internal network/Subnetwork with several other advantages over the classful addressing.
What is a Subnet?
As the name suggests, Subnet manifests itself as a judiciously evident sub-section(s) of a given internet network, thereby pioneering to a three-tier or a three-level-hierarchy IP addressing superseding the two-tier or two-level classful IP addressing scheme in IPv4.
Thus under Subnetted classful addressing an IP address can be divided into three parts, viz.
- Network ID [the number of bits/octets as the given (classful addressed) internet network]
- Subnet ID [formed by borrowing some bits from the host ID of internet network; these bits are used to identify individual internal Subnets within the given public network. Hosts are assigned to these Subnets]
- Host ID [the remaining number of bits of the host ID of the internet network after Subnet masking]
How is Subnetting done?
Subnetting is the method of dividing a network into Subnets. It is done by borrowing or allocating some (higher order) bits from the host ID of the given (classful addressed) internet network, and assigning those bits as a part of the network prefix.
It is to create a network within a network called subnet with the help of appropriate choice/adjustment of a Subnet mask.
An example of Subnetting
Consider the case of an IP address 220.127.116.11 whose binary notation is 11000000.11011100.00001010.10000010.
We can recognize that it is a class C IP address with its first 24 bits 11000000.11011100.00001010 [192.220.10] being the network ID, and the rest 8bits [after 24bits.], i.e., 10000010  being the host ID.
Subnetting here allows us to borrow some digits from the host ID, i.e., 10000010 to form Subnet ID.
Now the questions arise “how many digits can we borrow?”, “how the network will identify the borrowed bits?” And so on. The answer is hidden in the subject termed Subnet mask.
What is a Subnet Mask?
A subnet mask is a 32bit number represented in dotted decimal 4octet notation.
The concept of a Subnet Mask is based on the binary mathematics operation termed bit masking. In the bit masking, a unique pattern of zeros, and ones are obtained with the combination of Boolean functions like AND or OR to select or deselect specific bits in a number.
What is the procedure of Subnet Masking?
As a characteristic feature of the IPv4 network, the bitmask is applied to a 32bit IP address with the help of bitwise ‘AND’ operation between the IP address and the Subnet mask.
Each of the 32bits of the Subnet mask relates to the corresponding location-wise 32bits of the IP address.
The bits of the mask are so chosen that the bits parallel to each bit of the network ID, and those of the Subnet ID (which is formed by borrowing some bits from the host ID) are ones, while the bits against the host ID are zeroes.
The following table describes how we choose the Subnet mask and extract the network prefix for our referred IP address 18.104.22.168
|Network ID||Host ID|
|Borrowed high-order 2bits from host ID||10000010|
[AND operation of IP address & Subnet mask][22.214.171.124]
What is default Subnet Mask?
The default Subnet Masks for
Class A is 255.0.0.0
Class B is 255.255.0.0
Class C is 255.255.255.0
What are the advantages of Subnet and Subnet Mask?
Subnet mask allows dividing your available network into Subnets that will enable the network administrator to use an individual block of addresses on multiple physical addresses.
Employing a Subnet mask saves the router from handling all the bits of the 32-bit IP address. The router looks at the bits selected by the mask and identifies the network ID in the IP Address.
An intricate illustration of Subnetting
Let us tailor an internet network with class C IP address 126.96.36.199 assigned to an organization with the following steps of subnetting:
Step 1 of subnetting
First, we shall determine the number of Subnets required for the organization, logically organizing the subsections/Subnets department-wise, device-wise, floor-wise or otherwise.
Step 2 of subnetting
Then we shall find out the number of bits to be borrowed from the host part of the network. The classes of the IP addresses dictate the maximum number of bits allowable for borrowing, depending upon the number of bits in its host part.
However, the formula for determining the number of bits to be borrowed is governed by 2n-2= no. Of Subnets [where n is the number of bits actually borrowed, limited to allowable bits as per respective class of the IP address].
188.8.131.52 being a class c IP address has 8bits in host part.
So allowed borrowable bits is 8-2=6 [at least 2bits being left for host].
Suppose we need 6 subsections/Subnets. Therefore the above formula works out to n=3, which implies the bits required to be borrowed.
Step 3 of subnetting
Next by turning on[putting 1 against] the number of bits borrowed from the host part with the rest bits being turned off [putting 0]; we get the Subnet mask as 11111111.11111111.11111111.11100000 [255.255.255.244].
This 255.255.255.244 is an example of Variable-length Subnet Masking.
Step 4 of subnetting
By AND operation of IP address & Subnet mask, we get the network prefix as 184.108.40.206.
Step 5 of subnetting
Next, we find the host/Subnet variable. For this, we locate the lowest of the high-order bits of 11100000 which comes out to be 100000 which is the Subnet variable we are looking for.
Step 6 of subnetting
Now we set the range of subsets/hosts using the host/Subnet variable 32 in the following way:
220.127.116.11 to 18.104.22.168
22.214.171.124 to 126.96.36.199
188.8.131.52 to 184.108.40.206
220.127.116.11 to 18.104.22.168
22.214.171.124 to 126.96.36.199
188.8.131.52 to 184.108.40.206
220.127.116.11 to 18.104.22.168
22.214.171.124 to 126.96.36.199.
Step 7 of subnetting
Out of the above ranges, the first set of addresses 188.8.131.52 to 184.108.40.206, and the last series of addresses 220.127.116.11 to 18.104.22.168 are unusable, i.e., cannot be allotted to hosts for being the network ID and broadcast ID respectively. Thus we have 6 usable groups of addresses to demarcate 6 subnets/subsections intrinsically.
Step 8 of subnetting
In each case of these 6 usable Subnet ranges, we cannot designate the first and the last address to hosts as they denote the Subnet ID and the broadcast ID respectively by default.
Consequently, we can utilize the rest addresses of each of the 6 subnets available to designate hosts as per requirement.
How can we set up Subnets in IPv4, and IPv6 addresses?
What has been discussed till now is all about subnetting in IPv4. There we see that borrowing bits to create Subnets results in the lesser availability of bits for host addresses.
This problem is sorted out in a 128bit IPv6 address which contains bits for subnetting. You need not borrow digits from Host ID as practiced during subnetting of a 64bit IPv4 address.
A 128bit address has its most significant (leftmost) 64bits as Routing Prefix for routing, its least significant (rightmost) 48bits as Interface Id for hosts, and the middle 16bits as Subnet Id.
As a result, subnetting a 128bit address may have as much as 65 thousand subnets without compromising the host bits. IPv6 subnetting acts on the concept similar to the Variable-length Subnet Masking as detailed above.
The immense importance of subnets, as reflected in our discussion so far, is truly undeniable. This piece of information should have made you aware of the efficacy of IPv4, and IPv6 Subnetting in the world of the Internet. You should be now knowing how a subnet mask operates and aids a network administrator to segregate the network interfaces internally in the form of subnets.
Can you challenge yourself – A Task for you
Here is your exercise. Think of yourself as the network administrator of the office we mentioned at the beginning, and design the Subnets to allocate Subnetted classful IP addresses (IPv4) to the 500 computers. Feel free to reach out to us if you need any help.
|Was this article helpful?|
|Thanks for letting us know!|