struggling to find an easy way for subnet id

Your example with /22 has the significant digit (Last network or subnet bit as the 22nd one. The 22nd bit is in the fourth octet so you know the first two octets are not going to change so you have:

172.16.????.????

We can count, starting from 17 (Because the first two octets = 8 + 8 = 16) we know that the third subnet will have 6 bits as part of the network # and the remaining bits in the IP address are host numbers.

We can think of the bits like this:

NNNNNNNN.NNNNNNNN.SSSSSSHH.HHHHHHHH
N = Network S = Subnet H = Host

We also can infer that we have a total of 26 subnets = 64 that were created from that class B address. We also know that we have (210 ) - 2 hosts available on each of those subnets for 1,022 total possible hosts in each subnet.

Now, how to find out the subnet for the IP you have been given.

In the above example of the third octet, we have:

SSSSSSHH

If we think about the values of those bits, we can imagine this:

  S  S  S  S S S H H
128 64 32 16 8 4 2 1  <----- Value of the bit
  8  7  6  5 4 3 2 1  <----- Position of the bit

Our last Subnet bit is lined up with the 8s value so we know that each time our third octet goes up by a multiple of 8, we get a new subnet.

We look at the third octet (.209) and divide by eight and we get 26.(We don't actually care about the remainder). 26 * 8 = 208 and that is our network number (Subnet address).

Our complete answer is #172.16.208.0/22

We also know our first available host is 172.16.208.1/22, our next network is 172.16.216.0/22. The broadcast address for 172.16.208.0 is one less than that next network so it's 172.16.215.255/22 with the last available host on the subnet one less than that number = 172.16.215.254/22

/r/ccna Thread