Networking Concept – Subnet
Hello Friends,
Today we will discuss about the basic networking. Many of you are already aware of this, but you may need a refresher session. Nowadays all are approaching the Public cloud like AWS, AZURE, Google cloud, etc. Wherever you go, you have most basic requirement is network setup.
What is Subnet?
Subnet or Subnetwork is a logical division of a huge network IP range. We have a huge IPv4 range from 0.0.0.0 to 255.255.255.255. We can divide these IP ranges into a different logical network for better user and network isolation.
How is IPv4 represented?
IPv4 is represented in binary or decimal notation. You can see below:
DECIMAL | BINARY |
0.0.0.0 | 00000000.00000000.00000000.00000000 |
255.255.255.255 | 11111111.11111111.11111111.11111111 |
2^7 + 2^6 + 2^5 + 2^4 + 2^3 + 2^2 + 2^1 + 2^0
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
For example: If we took an octet 11000000.00000000.00000000.00000000 then it will be looks like 192.0.0.0
Now, we are going to discuss two different ways to create subnets:
2^7 + 2^6 + 2^5 + 2^4 + 2^3 + 2^2 + 2^1 + 2^0
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
For example: If we took an octet 11000000.00000000.00000000.00000000 then it will be looks like 192.0.0.0
Now, we are going to discuss two different ways to create subnets:
Classful Notation:
The IP range is divided into different classes for better use of the available IPs. If we just use complete range without subnetting then those are not enough IPs for all. So, the Classful notation came into the picture.
There are 5 below classes and range defined :
- Class A networks had the first octet between 1 and 127. These effectively used a 255.0.0.0 subnet mask.
- The class B first octet ranged between 128 and 192, using a 255.255.0.0 mask.
- And C used the 192 to 223 space using the 255.255.255.0 mask.
- Class D and E networks are designated for multicast 255.255.255.255 mask.
Classes (A-C) divided the networking and host portions of the address differently to accommodate different-sized networks.
Represent | Network Bit | HOSTs Count |
Class A | 255 | .0.0.0 |
Class B | 255.255 | .0.0 |
Class C | 255.255.255 | 0 |
For instance, for class C addresses, the first 3 octets are used to describe the network. For the address 192.168.0.15, the 192.168.0 portion describes the network and the 15 describes the host.
IP: | 11000000 – 10101000 – 00000000 – 00001111 (192.168.0.15) |
Mask: | 11111111 . 11111111 . 11111111 . 00000000 (255.255.255.000) |
— | —————————————————————- |
Start IP | 11000000 – 10101000 – 00000000 – 00000000 (192.168.0.0) |
This can be expressed as 192.168.0.0. The host specification is then the difference between these original values and the host portion. In our case, the host is “0000 1111” or 15.
The idea of subnetting is to take a portion of the host space of an address and use it as an additional networking specification to divide the address space again.
For instance, a netmask of 255.255.255.0 as we saw above leaves us with 254 hosts in the network (you cannot end in 0 or 255 because these are reserved).
If we wanted to divide this into two sub-networks, we could use one bit of the conventional host portion of the address as the subnet mask. We can use the first bit of our host to designate a sub-network. We can do this by adjusting the subnet mask from this:
11111111 – 11111111 – 11111111 – 00000000
To this:
11111111 – 1111 1111 – 11111111 – 10000000
In traditional IPv4 notation, this would be expressed as 192.168.0.128. What we have done here is to designate the first bit of the last octet as significant in addressing the network. This effectively produces two sub-networks. The first sub-network is from 192.168.0.1 to 192.168.0.127. The second sub-network contains the hosts 192.168.0.129 to 192.168.0.255. Traditionally, the subnet itself must not be used as an address.
If we use more bits out of the host space for networking, we can get more and more sub-networks.
I hope, this will help you to understand how the virtual networks are created in your public as well as private cloud. I will explain the CIDR (Classless Inter-domain routing) in the next blog.
Thanks for reading 🙂
Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more. If you have any suggestions/feedback/doubts, you are most welcome.
Stay tuned on the blog, will come up with more such articles.
Mayur KJ
Hello World!