A trick to solve subnetting problem

Recently in preparing for Ericssion IP certification, I came to a problem about dividing existing network to smaller network and decide subnet/network address/broadcast address etc.I find a solution to be easy to handle it.

Here you go.

Problem: 192.168.1.0/24 is going to be divided to 8 subnet each of which need have up to 30 host addresses.

1) We need care about the host address number. We know network address and broadcast address can not be defined as host address so plus these two we have total ip addresses in each group as 32.
2) The final ip address group will be like:

192.168.1.0 ~ 192.168.1.31
192.168.1.32~ 192.168.1.63
192.168.1.64~ 192.168.1.95
192.168.1.96~ 192.168.1.127
192.168.1.128~ 192.168.1.159
192.168.1.160~ 192.168.1.191
192.168.1.192~ 192.168.1.223
192.168.1.224~ 192.168.1.255

3) By checking 2) we can see in each sub group, the most right five bits are varying from 00000 to 11111. So each group has subnet 255.255.255.224 (224 = 1110 0000) so we can represent each group as 192.168.1.xxx/27

4) Doing from 2) to 3) are time consuming. By observation, we see the group number (8) in our problem can be represented by the left most 3 bits in the last section of the ip address. So once we have unique group number (000 to 111) the remaining 5 bits keep changing to construct the whole addresses for the group. And the subnet mask is determined only by the group number, which equal to say, the number of bits representing the group number.

Therefore, we can solve this problem simply by just see how many bits needed to represent group number.
In this problem, it's 3. Then we can get right away our new subnet mask for each subnet is 255.255.255.224 (the most left bits corresponding to the group number representation).

5)So suppose we need divide 192.168.1.0 to 4 subgroups what is subnet mask for each subnet? We can get it easily by converting 4 = 2 bits (00,01,10,11) so the answer is 255.255.255.192.

6)Now suppose we need divide 192.168.1.0 to 3 subnet equally what is subnet mask for each subnet?
Following the same rule, we use 2  bits to represent 3. So it's still 255.255.255.192.

Let's verify it. 256/3 = 85 so each group we have 85 addresses and 1 remaining will be wasted. Let's say  192.168.1.255 will not be used.

So the groups are:
192.168.1.0 to 192.168.1.84
192.168.1.85 to 192.168.1.169
192.168.1.170 to 192.168.1.254

Group 1) bits grows from 0000 0000 to 0101 0100 Subnet mask: 255.255.255.128.
Group 2) bits grows from 0101 0101 to 1010 1001 Subnet mask: 255.255.255.0
Group 3) bits grows from 1010 1010 to 1111 1110 Subnet mask: 255.255.255.128

So we see the solution doesn't work here .

7) From the two examples we see that the trick only works for the group number which can be fully represented by exponential of 2 like (1,2,4,8, 16, etc) But other way to divide the network to subnets, this doesn't work. But knowing the trick can help easily solve problems in such questions in CCNA/ETC-IP test.

Comments

Popular Posts