# How to assign 2000 addresses starting from 198.16.16.0? [duplicate]

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

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?

## marked as duplicate by Zac67, Teun Vink♦Aug 27 '18 at 7:15

• Any IP address range described with a mask of length >=16 won't see a change in its second octet. Page 26 of that version of the document, providing the solution to problem 30 contains 4 major errors. All supposedly correct answers have mask lengths longer than /16 (/20, /21, /20, /19). – Marc 'netztier' Luethi Aug 27 '18 at 7:35
• I stand corrected - 3 errors. Answer A for problem 30 is given correctly; B,C,D are wrong in that (version of the) document. – Marc 'netztier' Luethi Aug 27 '18 at 7:45
• @Marc'netztier'Luethi Unfortunately I Googled more about the problem and all universities which teach networking and have public materials on the net consider that answer as right. For example FIT(Florida Institute Of Technology) has the same question with the same answer in an exam but doesn't explain how they got there which is weird and I Googled around and couldn't find a single explanation how they got those numbers. – mcdonald reversed Aug 27 '18 at 7:47
• Suggestion: Pick any of the myriads of subnet calculator tools from the web, and see what they give you for 198.16.16.0/21, 198.16.32.0/20 and 198.16.64.0/19. None of the answers will see the second octet changed. It has to be a really bad case of copy&waste, then. – Marc 'netztier' Luethi Aug 27 '18 at 7:51
• @Marc'netztier'Luethi Agreed - `B: 198.16.16.0 – 198.23.15.255 written as 198.16.16.0/21` should really be `B: 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 8:41

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.

• This is from Tannenbaum official manual for the solutions. Before that we have to assign 4000 hosts to it but I don't know if that should matter. – mcdonald reversed Aug 27 '18 at 6:37
• Well, whichever way you turn it, 198.16.16.0/21 is 198.16.16.0 to 198.16.23.255. While a /21 with its 2048 addresses is mathematically correct/sufficient to cover 2000 hosts, a real-world IP allocation for 2000 hosts should probably leave a bit more room for IP addresses of router interfaces, loopbacks, SVIs, possibly the occasional point-to-point links etc. – Marc 'netztier' Luethi Aug 27 '18 at 7:25