I was answering some Summary Address questions,

and one problem is this. through

do I really need to one by one 1 to 120 convert them to binary and to find where is the exact common bits. It's too tiring to write it down.

Is there any technique to make it faster?

I'm new in networking.

  • IP addresses and masks are 32-bit binary numbers. The dotted-decimal notation is just to make it easier for humans to read, but it isn't the real address, and all calculations are bitwise. Convert to binary, perform your calculation on the binary numbers, and convert back to decimal. This makes the calculations easy and much less error prone, and unless, and until, you can do the conversions in your head, you should do it on paper. In binary, the correct answer is obvious. – Ron Maupin Jan 13 '16 at 14:38
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer. – Ron Maupin Aug 13 '17 at 3:05

I made this example to try and demonstrate it for you:

You only need the first and last addresses:

To summarize you look at how many bites are the same, 
in this case the first 17 bites are equal:

= /17 or or 

Another example with different addresses: = 00001010.00000001.00000001.00000000 = 00001010.00000001.00000010.00000000
00001010.00000001.000000|00.00000000 = /22

== or
| improve this answer | |

It depends if you are seeking to find the single summary network that covers at least all of your list, or the shortest list of networks that covers your list exactly.

In the first case, what Bungicasse described works.

In the second case, it's not very difficult, and is a lot like the problem of handing back change for a payment with a minimal number of coins. You just go through it methodically, with subnets of decreasing size.

You would consider that a /17 ( to is too large, and that /18 ranges ( to or to do not align on the right ranges. So you start with 2 /19 s and fill in with smaller ranges above and below them

  • a /24 : to
  • a /23 : to
  • a /22 : to
  • a /21 : to
  • a /20 : to
  • a /19 : to
  • a /19 : to,
  • a /20 : to,
  • a /21 : to
  • a /24 : to
| improve this answer | |
  • Quite right, thanks @TeunVink, I misread the question. Correction made. – Jeremy Gibbons Jan 13 '16 at 12:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.