This problem comes from Tannanebaum's CN book and the full description of it is as follows:
A large number of consecutive IP addresses are available starting at 198.16.0.0. Suppose that four organizations, A, B, C, and D, request 4000, 2000, 4000, and 8000 addresses, respectively, and in that order. For each of these, give the first IP address assigned, the last IP address assigned, and the mask in the w.x.y.z/s notation.
The answer given is as follows:
To start with, all the requests are rounded up to a power of two. The starting
address, ending address, and mask are as follows:
A: 198.16.0.0 – 198.16.15.255 written as 198.16.0.0/20
B: 198.16.16.0 – 198.23.15.255 written as 198.16.16.0/21
C: 198.16.32.0 – 198.47.15.255 written as 198.16.32.0/20
D: 198.16.64.0 – 198.95.15.255 written as 198.16.64.0/19
With my understanding of subnetting, this answer doesn't make sense.
If my understanding is correct to find the number of bits for the host log 2 of 2000 = 11 bits for the host. In other words we need to reserve 11 bits in total to identify the host.
The mask would be 11111111.11111111.11111|000.00000 = 255.255.248.0.
The first address is in the case that we leave all of the host bits as 0s:
In that case we get: 198.16.16.0 To find end address all host bits need to be 1s:
198.16.(5 bits reserved)111, 111111111 Then we get: 198.16.10001111.11111111 = 198.16.143.255 Which is a wrong answer.
The right answer is: 198.16.16.0 – 198.23.15.255 written as 198.16.16.0/21.
Where did I go wrong and how is that answer computed?
B: 198.16.16.0 – 198.23.15.255 written as 198.16.16.0/21
should really beB: 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21
and so on. Pretty pitiful teaching I'd say.... – Zac67 Aug 27 '18 at 08:41