They give me the IP address, number of hosts, and number of subnets.
So I've read somewhere that there are two methods:
Method A ) Using the number of subnets needed.
Method B ) Using the number of hosts needed.
Let's see an example:
IP is 10.253.113.0/25. We need 8 subnets with 10 hosts each one.
Method A ) 3 bits are required for 8 subnets, so 25+3=28, so our subnet mask is /28.
Method B ) 4 bits are required for 10 hosts, so if an IPv4 address has 32 bits, and we only need 4 for hosts, we do 32-4 = 28, so our subnet mask is /28.
Great. Amazing. Awesome. So both methods are valid.
Let's see another example:
IP is 146.201.0.0/16. We need 126 subnets with 126 hosts each one.
Method A ) 7 bits are required for 126 subnets, so 16+7=23, so our subnet mask is /23.
Method B ) 7 bits are required for 126 hosts, so if an IPv4 address has 32 bits, and we only need 7 bits for hosts, we do 32-7 = 25, so our subnet mask is /25.
In this example the subnet mask doesn't match. So both methods aren't valid? Which method would you use if you get asked the second example in a multiple-choice question and the answers are: a) 23 b) 24 c) 25 d) 26? (edit: previously it was a) 24 b) 25 c) 26 d) 27)
Or just please explain what I'm doing wrong, if anything.