Could someone explain me if the numbers mentioned below are on the same subnet or not.
172.16.100.1/ 21 and 172.16.100.2/ 21
/ 21 = 255.255.248.0
I know how to find the subnet mask, but in this particular case I have some doubt about how to know whether those numbers are located on the same subnet or not.
Yes the are
172.16.100.1 and 172.16.100.2 are part of this subnet
172.16.96.0/21 which has the following
Network address: 172.16.96.0
Broadcast address: 172.16.103.255
Usable address range: 172.16.96.1 to 172.16.103.254
Total number of usable IP addresses is 2046
Hope this helps...remember to rate helpful post.
The trick to this or any subnetting question like this is to focus on the "interesting" octet. In your case, a /21 does indeed translate into a 255.255.248.0 subnet mask. The "interesting" part is the octet represented by the first part of the subnet mask that is NOT 255 starting from the left. In this case a .248 appears in the third octet of the subnet mask, so the interesting octet in the IP will also be the third octet.
IP 172.16.100.1 Third octet = 100. This is the interesting octect.
To determine what IP addresses are included in a given subnet, you would begin by finding the block size. The block size is simply the increment that the 'interesting' octect must be increased by to arrive at the next subnet network address beginning at 0. To find the block size, simply subtract the value in the interesting octect of the subnet mask from 256.
in this case... 256 - 248 = 8
Also worth noting, is that dividing this number (8) into 256 gives you the total number of networks of that size available to you with that subnet mask.
So 256/8=32, this means that 172.16.0.0 can be broken down into 32 /21 networks beginning with 172.16.0.0.
To figure out if your 2 IPs are in the same network, you have to list out all the networks by block size by first setting the "interesting" octet and any trailing octets to 0. In this case we begin with 172.16.0.0 and increase the 3rd octet by 8 until you get to the blocks that contain the IPs in question.
<---- 172.16.100.1 and 172.16.100.2 fit here
So the IPs 172.16.100.1 and 172.16.100.2 are both in the 172.16.96.0/21 subnet which comprises IPs from 172.16.96.0 (network address) to 172.16.103.255 (broadcast address)
Hope this helps.