Subnetting is basically dividing your network in different sub networks. By doing this, you can produce different broadcast networks with you one nework. You can do this with fixed length or variable length Subnetting Mask.
There are types of Subnetting. These Subnetting Types are:
As you know there are IP classes of IPv4 addresses. With these IP classes, there are fixed subnets that has fixed number hosts and networks. For example a Class C address has 24 bits network part and 8 bits host part. Or in Class A addresses, this is reverse. There are 8 bits network part and 24 bits host parts. This is an inefficient use of ip addresses. You should use strict numbers and ip address waste is a lot.
To overcome this issue, Classless Subnetting is used. In this subnetting type, subnet has different lengths and different hots and networks are in these subnets. In other words, there is not a strict rulet o use a specific subnet mask for any class or any type of ip address. Here, you can use /24 for an ip address 10.0.0.1 or you can use /8 for an ip address 202.145.4.78. There is no classes and there is no specific class Subneting masks.
For your Subnetting Mask Calculations and Subnetting Operations, you can use our Subnetting Cheat Sheet.
Table of Contents
In this lesson, we will learn IP Subnetting with examples. Here, we will give different types f subnetting examples and with these subnetting examples, you will be ready for real World subnetting operaitons. So, let’s start our examples and overcome this basic lessons of networking.
We have an IPv4 Prefix 100.100.0.0/24. How can we divide this IPv4 prefix into two different subnet?
As you can see below, we will use this two subnets for different networks that is connected to our router.
Firstly, lets write our IPv4 address in binary format.
Decimal : 100.100.0.0/24
Binary : 01100100.01100100.00000000.00000000 /24
According to our prefix, our subnet mask is /24. This means that, our first 24 bits are network and the remaining parts are host bits in this subnetting mask. Here, hosts bits are 32-24=8 bits.
So, to divide this network, we should borrow some bits from the host part. So, how many bits we will borrow? To determine this, we will check our subnet need. How many subnet do we need? For this question, we need 2 subnets. So, we will borrow 1 bit from host part. Why 1 bit?
2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16
2^5 = 32
2^6 = 64
2^7 = 128
2^8 = 256
As you can see above, with 1 bit, we can have 2 subnets (2^1=1).
After borrowing this address, our network part will be 24+1=25 bits. So, for these two new subnets, subnet mask will be /25. And host parts will be 8-1= 7 bits.
To build these two subnets, we will change the borrowed bit only. We will use 0 and 1 for this borrowed bit. As you can see below, it is the first bit of the last octet.
Original Prefix : 01100100.01100100.00000000.00000000
Original Prefix : 01100100.01100100.00000000.00000000 (Borrowed Bit)
So, in decimal, our subnets will be like below:
We have an IPv4 Prefix 72.14.15.0/24. We would like to use this prefix in 4 different networks for maximum 62 users in each network. Which network addresses should we use for these new networks?
Let’s write our address in binary format again. Here, I am writing these addresses in binary format to show you. With more practices, you will not need to do this and you can quicly determine the subnet values.
Decimal : 72.14.15.0/24
Binary : 01001000.00001110.00001111.00000000 /24
Here, again we have 24 bits network part and 8 bits host part according to our subnetting mask. To have 4 networks, we should borrow 2 bits from the host parts. With this 2 borrowed bits, we will have 2^2=4 networks. Our Subnet Mask will be /26. And remaining host part is 8-2=6 bits. And with this 6 bits, we will have 2^6=64 addresses. One of these addresses is network and the other is broadcast address. So, remaining 64-2= 62 addresses can be used by hosts. In our question, it is mentioned that maximum 62 users are in one network. So, our calculation also meets this requirement.
Original Prefix : 01001000.00001110.00001111.00000000
Original Prefix : 01001000.00001110.00001111.00000000 (Borrowed Bits)
We will write the combinations only changing these borrewed bits. As you can see below, we have 4 combinations.
According to these combinations, oll the last octets are appeared. So, in decimal format, our new network addresses will be like below:
As you can see above, in each of these networks, maximum 62 users an get ip addresses. For example in the first network, lets write these addresses:
Network Address : 72.14.15.0/26
Host Addresses : 72.14.15.1/26, 72.14.15.2/26, 72.14.15.3/26 …… 72.14.15.62/26
Broadcast Address : 72.14.15.63/26
Here, let’s explain these addresses more. As you can see above, the network address is the subnet address. It is the first address of this new subnet. In this address, all the host bits are “0” like below:
Network Address : 72.14.15.0/26 00 000000 (last octet)
In broadcast address, all the host bits are “1” as reverse.
Broadcast Address : 72.14.15.63/26 00 111111 (last octet)
The hosts addresses are the addresses apart from these two addresses. Here, the are 62 combinations.
Host Addresses :
72.14.15.1/26 00 000001 (last octet)
72.14.15.2/26 00 000010 (last octet)
72.14.15.3/26 00 000011 (last octet)
……
72.14.15.62/26 00 111110 (last octet)
We have an IPv4 Prefix 200.200.10.0/25. We would like to use this prefix for the below networks and user requirements:
What are the new subnets for these networks?
Decimal : 200.200.10.0/25
Binary : 11001000.11001000.00001010.00000000 /25
Here, our host parts are the last 7 bits in the last octet. So how can we devide our IPv4 prefix in to these 5 network? To do this we should find the borrowed bits first again. So, according to the below table,
2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16
2^5 = 32
2^6 = 64
2^7 = 128
2^8 = 256
We should borrow at least 3 bits. Because with 2 bits we can have only 4 subnets. So, we will borrow three of host bits.
Binary : 11001000.11001000.00001010.00000000 /25 (borrowed bits)
1.Subnet 11001000.11001000.00001010.00000000 200.200.10.0/28
2.Subnet 11001000.11001000.00001010.00010000 200.200.10.16/28
3.Subnet 11001000.11001000.00001010.00100000 200.200.10. 32/28
4.Subnet 11001000.11001000.00001010.00110000 200.200.10.48/28
5.Subnet 11001000.11001000.00001010.01000000 200.200.10.64/28
6.Subnet 11001000.11001000.00001010.01010000 200.200.10.80/28
7.Subnet 11001000.11001000.00001010.01100000 200.200.10.96/28
8.Subnet 11001000.11001000.00001010.01110000 200.200.10.112/28
9.Subnet 11001000.11001000.00001010.10000000 200.200.10.128/28
10.Subnet 11001000.11001000.00001010.10010000 200.200.10. 144/28
11.Subnet 11001000.11001000.00001010.10100000 200.200.10. 160/28
12.Subnet 11001000.11001000.00001010.10110000 200.200.10. 176/28
13.Subnet 11001000.11001000.00001010.11000000 200.200.10. 192/28
14.Subnet 11001000.11001000.00001010.10000000 200.200.10. 208/28
15.Subnet 11001000.11001000.00001010.10000000 200.200.10. 224/28
16.Subnet 11001000.11001000.00001010.10000000 200.200.10. 240/28
With this new calculation, we will have 2^3=8 subnets with 25+3=28, /28 subnet mask. Each of these addresses has 2^4=16 addresses. But this is too much for some of the networks that has lower number of users. So, we will divide our subnets again.
Let’s remember our networks:
We can use one of the created subnets for three of this networks. The third, fourth and the fifth one. These networks need 14,10 and 9 users and to have these users we should have at least 4 bits in the host part. And the created subnets can meet this requirement. So, we will use the below network addresses for the below networks:
For the remaining two networks, we will devide one of the new networks again. Let’s use 200.200.10.48/28 prefix for this.
Here, we have 2 remaining networks. So, we will use 1 borrowed bit for 2 networks. 2^1=2
After borrowing a bit, our subnet mask will be /29 and the remaning host bits will be 3. With these host bits, we can have 2^3=8 addresses in each network. And one of these addresses is network address and the other is broadcast address. So, in each of these new networks, there are 8-2=6 usable host addresses.
What are the requirements of our remaning networks?
For these networks, our calculation meet the requirements. We have two new subnets created from 200.200.10.48/28. And each of these networks has at least 6 usable host addresses.
So, let’s write used subnet for this second dividion and write the newly created subnets:
4.Subnet 11001000.11001000.00001010.00110000 200.200.10.48/28
4.Subnet 11001000.11001000.00001010.00110000 200.200.10.48/28 (borrowed bit)
4a.Subnet 11001000.11001000.00001010.00110000 200.200.10.48/29
4b.Subnet 11001000.11001000.00001010.00111000 200.200.10.56/29
Here, you can also quickly device the number without writing in binary format. Think about it. After borrow, you have 3 bits remaining and this means 8 addresses. We only use borrowed bit as “0” and as “1”. So, with “0”, the address remains only the mask is changing fort he first subnet. And for the second one, borrowed bit become “1”. This means that our second network address is the address after 8 address later from the first network. First network was 200.200.10.48/29 and the second one is 200.200.10.56/29 (48+8=56).
As you can see, we have used our ip addresses very efficient with different subnetting masks. And in the future requirements, we can use other address ranges form our ip address assignments.
am so so proud of this teaching
Thank you very much Elie :) Good luck!