I would recommend googling some examples of VLSM and practice practice. I found the Subnet Game by Cisco very handy.
Variable Length Subnet Mask is subnetting a subnet. There are many different ways to subnet and I would recommend finding the one that works for you.
Lets subnet 192.168.2.0/24 to accommodate the following network design:
Always start with the highest requirement which is 100 users on RouterB.
We need at least 100 IP addresses.
Lets convert 100 to binary:
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
If we count from right to left, we need 7 bits to make 100 addresses (Last bit in 64 = 7 bits).
128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Using the above table we want to ‘save the hosts’ so counting from right to left we will want to save 7 bits and put a 1 in the 128 column. Therefore 255.255.255.128 will be our subnet mask or /25. The subnet will be 192.168.2.0 /25 (Hosts: 192.168.2.1 – 192.168.2.126).
The next largest is RouterC with 50 users, Lets convert 50 to binary:
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
If we count from right to left, we need 6 bits to make 50 addresses.
128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 |
1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
The subnet mask that meets this requirements is 192.168.2.128 255.255.255.192 or /26 (Hosts: 192.168.2.129 – 192.168.2.190) – This will give us 62 hosts.
Lastly RouterA has 15 users. Lets convert 15 to binary:
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
If we count from right to left, we need 4 bits to make 15 addresses.
128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 |
1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
This one is a little tricky, if we follow the trend from the first two routers we will reserve 4 bits making the subnet mask 255.255.255.240 /28 however, this will only give us 14 hosts (256-240=16 -2 for subnet and broadcast = 14) and not 15. Watch out of this! We in fact want to use 255.255.255.224 /27 which will give us 30 hosts.
The IP subnet for Router C will be 192.168.2.192 255.255.255.224 or /27 (Hosts: 192.168.2.193 – 192.168.2.222)
This gives us some room to expand the 192.168.2.0 subnet in the future.
Summary:
RouterB: 192.168.2.0 /25
RouterC: 192.168.2.128 /26
RouterA: 192.168.2.192 /27