Today in this video lets understand subnetting in detail.
After completing this video you will be able to tell the range of given IP address and subnet mask and you will also be able to explain how to divide the big network into small subnets and you will be able tell the range of IP address in any subnet.
Lets take one example:
192.168.1.0/24
Complete IP has 32 bits.
here /24 represents subnet mask, 24 means 24 1's and 8 0's
11111111.11111111.11111111.00000000
In the similar fasion, split this network into binary:
11000000.10101000.00000001.00000000
Keep two rows below to each other:
11111111.11111111.11111111.00000000
11000000.10101000.00000001.00000000
wherever there is one in subnet mask, corresponding number associated do not change. Where there is 0 in subnet mask, respective number will change.
So first 24 bits of IP address do not change and rest of the bits have minimum and maximum like below:
Minimum value of the range:
11000000.10101000.00000001.00000000-11000000.10101000.00000001.11111111
192.168.1.0-192.168.1.255
This is the range of the given IP: 192.168.1.0/24
Lets take another example to understand better:
10.0.0.0/8
Since its 8, in total you will have 8 1's and 24 0's.
11111111.00000000.00000000.00000000
00001010.00000000.00000000.00000000
Same formula, wherever there is 1 that number wont change and rest of the numbers will change.
So,
minimum will be:
00001010.00000000.00000000.00000000
maximum will be:
00001010.11111111.11111111.11111111
If we convert into binary:
its 10.0.0.0-10.255.255.255
Lets take another example:
172.16.0.0/16
Now i need range for this IP address.
Split into binary:
Subnet mask:11111111.11111111.00000000.00000000
IP address :10101100.00010000.00000000.00000000
Keep the numbers which are mapping with 1 wont change and the one mapping with 0, will change.
So now minimum address:
10101100.00010000.00000000.00000000-10101100.00010000.11111111.11111111
If we convert to normal IP form:
172.16.0.0-172.16.255.255
Now we got three ranges from three examples:
192.168.1.0-192.168.1.255
172.16.0.0-172.16.255.255
10.0.0.0-10.255.255.255
First IP of any range is called network ID which represents entire network, you cannot assign this IP to any device.
Last IP of any range is called broadcast IP, if we initiate request to this IP address it will reach all the machines in that network.
So first and last IP address are unusable.
So valid ranges are:
192.168.1.1-192.168.1.254
172.16.0.1-172.16.255.254
10.0.0.1-10.255.255.254
But if you observe first range, it has 256 IP address.
In my office i hardly has 10 IP address why do i need 256 IP address for my machines, managing them through firewalls become difficult.
So, i want to subnet this network. If you observe, if subnet mask has higher value, number of hosts in the network will be less.
Take above examples:
192.168.1.0/24---(2^(32-24)-2)=(2^8-2)=254(this is the formula to calculate number of devices inside network.)
172.16.0.0/16----(2^(32-16)-2)=(2^16-2)=65536-2=65534
10.0.0.0/8-------(2^(32-8)-2)=(2^24-2)=16777216-2=16777214
So if the subnet mask has small value, number of hosts inside network will be more.
So, lets take this example:192.168.1.0/24
Increase subnet mask to 16, lets see how many hosts we will get:
192.168.1.0/26.
Lets use same formula=(2^(32-26)-2)=(2^6-2)=(64-2)=62 hosts
We need only 10, we do not need 62.
Lets use:
192.168.1.0/28
Use same formula=(2^(32-28)-2)=(2^4-2)=14 IP address.
Lets check if we can reduce even less than this.
192.168.1.0/29
2^(32-29)-2=2^3-2=6
So i just got 6 IP address for /29 subnet mask, i need to go for /28 subnet mask because it accomodated 14 IP address.
Now lets understand what is the range of that IP address.:
192.168.1.0/28
Subnetmask:11111111.11111111.11111111.11110000
IP addres :11000000.10101000.00000001.00000000
Where there is one in subnet mask, keep the respective value same and rest of the values should be 0 in minimum ip range and 1 in maximum ip range.
Range of the IP address:
Minimum ip range:
11000000.10101000.00000001.00000000
Maximum ip range:
11000000.10101000.00000001.00001111
So, range in decimal is:
192.168.1.0-192.168.1.15
Valid IP range is: 192.168.1.1-192.168.1.14
Thanks for watching this video, for mock interview scheduling and network interview guidance you can reach out to us through telegram and instagram.
Instagram:
https://www.instagram.com/inside_thei...
Telegram:
https://t.me/firewallgeeks
See you in the next video, Happy Learning!