Hello Simon
Subnetting can become confusing simply because we’re trying to view IP addresses in decimal, when routers themselves see them only as binary entities. I hope some of the following will clear up your confusion.
When you are given an initial IP range and asked to subnet it into smaller subnets, the resulting prefix must get larger. For example, if 172.16.0.0/24 is your initial range, smaller subnets will have larger prefixes, so the /24 should be a bigger number. This is because the number of bits representing the network should be more, and the number of bits representing the host should be fewer.
The /24 prefix corresponds with a subnet mask of 255.255.255.0, which corresponds with 256 host addresses, including the network and broadcast addresses. Similarly, take a look at what other prefixes correspond to:
- /25 = 255.255.255.128 = 128 addresses including nw and bc
- /26 = 255.255.255.192 = 64 addresses including nw and bc
- /27 = 255.255.255.224 = 32 addresses including nw and bc
- /28 = 255.255.255.240 = 16 addresses including nw and bc
- /29 = 255.255.255.248 = 8 addresses including nw and bc
- /30 = 255.255.255.252 = 4 addresses including nw and bc
So if you start off with a /24 address range, you have 256 addresses. If you want to split this up into 64 smaller subnets, what size subnet would you have? To find out, do the following:
size of original subnet / number of subnets you want: 256/64 = 4
So you need to find the prefix, or subnet mask, that will give you subnets of size 4. Which is that? It’s /30 or 255.255.255.252.
So subnet 0 would be 172.16.0.0/30 which gives you a range of addresses from 172.16.0.0 to 172.16.0.3
Similarly:
- subnet 1 is 172.16.0.4/30 with a range of 172.16.0.4 to 172.16.0.7
- subnet 2 is 172.16.0.8/30 with a range of 172.16.0.8 to 172.16.0.11
- subnet 3 is 172.16.0.12/30 with a range of 172.16.0.12 to 172.16.0.15
- subnet 4 is 172.16.0.16/30 with a range of 172.16.0.16 to 172.16.0.19
- …
- subnet 1 is 172.16.0.248/30 with a range of 172.16.0.248 to 172.16.0.251
- subnet 1 is 172.16.0.252/30 with a range of 172.16.0.4 to 172.16.0.255
Now VLANs and their IDs have nothing to do with the actual IP addresses used for each subnet. You can choose to configure the hosts on a particular VLAN with whatever IP subnet you like. In your post, you mention that subnet 0 should be put on VLAN 10 and subnet 1 on VLAN 20. That’s achievable, just configure the hosts on those VLANs within the right subnets. If you are asked to configure the VLAN itself with an IP address (that is, on the switched virtual interface or SVI, then you can do so).
In order to further understand these concepts, I suggest you go through these lessons.
I hope this has been helpful!
Laz