Subnetting cheat sheet in real Life networks
Subnetting can seem complicated, but with this cheat sheet subnetting will more of a fun game rather than a nightmare for beginners. The tutorial below contains very important tips on subnetting. After discussing what IP addresses are and how they work, we’ll take a look at what subnetting is. I’ll cover different topics on subnetting. All of the concepts in this subnetting guide are broken down into small parts, to make this topic as digestible as possible.
Table of contents.
- IP address
- what is subnetting?
- why do we use subnetting?
- subnetting easy way
- subnetting Questions and explanations
- practice Questions
An Internet Protocol address is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. An IP address serves two main functions: host or network interface identification and location addressing. At least that what Wikipedia says.
So IP address is a unique identifier address used to identify the device on the network. There are 2 types of IP address IPV4 and IPV6. IPV4 is our point of concern in this blog, we’ll talk about IPV6 subnetting in another blog.
IPV6 address format was discovered because we were running out of IPV4 addresses. IPv6 uses a 128-bit address, theoretically allowing 2^128 or approximately 3.4×10^38 addresses.
IPV4 is widely used in today's network. IPv4 uses a 32-bit address space which provides 4,294,967,296 (2^32) unique addresses, but large blocks are reserved for special networking methods.
IPV4 address has two parts one is called the Network address and the other is the Host address. It is a 32-bit long address which we see in decimal format.
let's say IP 192.168.1.2 has subnet mask 255.255.255.0
Network Address: This part of the IP address is an identifier of the network portion(192.168.1.x in our example).
Host address: This part of the IP address is an identifier of that host(x.x.x.2 in this example) that is on that network (192.168.1.x)
Subnet bits are used to identify which portion of the address is the network or which portion of the address is the host.
what is subnetting?
Now that we have talked about IP addresses let's talk about subnetting.
Subnetting is used for breaking down larger networks into smaller ones called subnetting. Think of it as compartmentalizing a big room into smaller ones, the compartment should be called a subnet.
If you put your network in one subnet and you have a large business meaning a large number of hosts, you would run into serious trouble because those devices would make an enormous amount of traffic leaving that network unusable. And it would cause major security issues too if you care about that.
so it's a best practice to subnet your network into smaller usable networks so subnetting is a major part of networking.
why do we use subnetting?
subnetting is a practice to divide a bigger network into smaller networks. It makes network admin’s life easy to handle network easily. Subnetting gives full control on your network which results in more manageable networks.
subnetting avoid security issues in our networks by separating hosts into separate broadcast domains (A broadcast domain is a logical division of a computer network, in which all nodes can reach each other by broadcast at the data link layer.)
If we have a big organization which is located in different physical locations and has separate branches let's say branch A is in New York and branch B is in Los Angelas, subnetting can help us to divide our classful IP address into different classless address.
so what’s classful and classless subnetting, let’s learn about CIDR next.
Wikipedia says “ Classless Inter-Domain Routing is a method for allocating IP addresses and for IP routing. The Internet Engineering Task Force introduced CIDR in 1993 to replace the previous classful network addressing architecture on the Internet ”
As we know in IP address is divided into two portions one portion is for the network and the other is for the host.
Classful addressing is classified under five heads (we’ll only talk about three as they are more important) with a fixed number of a network ID and host ID. classful addressing divides the 32-bit ipv4 address into two portions with fixed network and host bits which are then assigned to the businesses and personal use.
in-class A addresses first 8-bits are reserved for the network portion and the remaining 24-bits are reserved for the host portion.
In class B addresses first, 16-bits are reserved for the network portion and the remaining 16-bits are reserved for the host portion.
In class B addresses first, 24-bits are reserved for the network portion and the remaining 8-bits are reserved for the host portion.
So its a problem for the small business that doesn't need these many IP addresses or let's say our organization installed a new branch in Boston which is branch C which only needs the IP addresses for 20 hosts, had to assign class C subnet here and we’ll be wasting lots of address that we don’t need because of fixed network bits and host bits.
what if you could scale our subnets without any restriction of network bits and only assign the address we need without wasting our money on those lots of IP addresses, to solve this issue CIDR was introduced.
With CIDR we can scale our networks into small subnets by varying our network bits according to our needs.
So how do we subnet our network let’s see?
Subnetting easy way
- how to find out the number of networks?
To know how many subnetting bits we need to create how many networks we use the power of 2
For example, if we want to know many networks can be created from 3 Subnetting bits, we will use power 2 three times. (always count network bits from right to left from host portion)
00000000 00000 000 | 00000000 00000000
2³ = 8
here we get 8 networks.
- how to find out the number of hosts?
In each network, the first address and last address are always reserved for the network address and broadcast address respectively. Besides these two addresses, all remaining addresses are considered valid host addresses.
To know how many network bits we need to get how many hosts we use the power of 2 minus 2 ( for network and broadcast address).
for example, if we want to how many hosts we can get from 3 subnetting bits, we will use power 2 three times minus 2. (remember always count host bits from left to right from the network portion)
00000000 00000000 | 000 00000 00000000
2³ = 8–2 = 6
so here we get 6 hosts.
subnetting Questions and explanations
Question: What is the broadcast address of the network 172.23.20.0/23?
Explanation: here we have subnet mask /23 (it's classless)
it means we have 9 host bits here
00000000 00000000 0000000 | 0 00000000
the bold part is the host part the decimal to the binary format of IP given below.
10101100 00010111 0001010 |1 11111111
to find out the broadcast address we turn all bits to 1 now calculate that in decimal.
16 + 4 +1 = 21
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
so the answer is 172.23.21.255
remember the 11111111 in decimal is 255 refer to the chart above.
if we solve this problem further we can find network bits and host bits too
network address — 172.23.20.0
because, in network bits all the host bits are set to 0
10101100 00010111 0001010 |0 00000000 = 172.23.20.0
so the usable host address range is 172.23.20.1–172.23.21.254
so lets check our final result in free online calculator https://www.adminsub.net/ipv4-subnet-calculator/172.23.20.0/23 here's the final result.
- 255.255.254.0 = 23
- Class B
- First IP
- Last IP
- supported Hosts
practice makes you perfect!
you can refer to http://www.subnettingquestions.com/ for practicing questions.
So here's the happy ending of my first blog hope you enjoyed it and learned something, Thanks for reading.
(Note: the images and websites used in this blog are not mine if you want them to be removed you can contact me, thanks)