0

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?

YLearn
  • 27,511
  • 5
  • 62
  • 130

1 Answers1

2

255.255.248.0 or /21 is 3 bits (8 times, in decimal) larger (or "shorter") than /24 - which in turn makes for 8 consecutive /24s. Then, 8*256 = 2048, which nicely covers the 2000 requested addresses.

198.16.16.0/21 is not 198.16.16.0 - 198.23.15.255. That range can't even be nicely covered by a single net/mask combination.

That supposedly "correct" answer is IMHO wrong.

ADDED: Your question was actually: "Where did I go wrong [...] ?"

Answer: You did almost not. You found the mask 255.255.248.0 (a.k.a /21) which is correct.

However your calculation of the last address 192.16.143.255 (wich should be 198.16... in any case) is off, it would be 198.16.23.255; the binary&masked representation of the 3rd octet of 198.16.16.0 should be 0001'0|xxx, not 1000'1|xxx

As for how the textbook answer was calulated: See my comment - that can only be explained by neglect or copy and waste.

Marc 'netztier' Luethi
  • 8,971
  • 2
  • 15
  • 32