1

I was answering some Summary Address questions,

and one problem is this.

192.168.1.0 through 192.168.120.0.

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
3

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

You only need the first and last addresses:

192.168.1.0
11000000.10101000.00000001.000000000

192.168.120.0
11000000.10101000.01111000.000000000

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

192.168.0.0
11000000.10101000.00000000.000000000

= /17 or 255.255.128.0

192.168.0.0/17 or 192.168.0.0 255.255.128.0 

Another example with different addresses:

10.1.1.0 = 00001010.00000001.00000001.00000000
10.1.2.0 = 00001010.00000001.00000010.00000000
==
00001010.00000001.000000|00.00000000 = /22

==
10.1.0.0/22 or 10.1.0.0 255.255.252.0
| improve this answer | |
1

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 (192.168.0.0 to 192.168.127.255) is too large, and that /18 ranges (192.168.0.0 to 192.168.63.255 or 192.168.64.0 to 192.168.127.255) 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 : 192.168.1.0 to 192.168.1.255
  • a /23 : 192.168.2.0 to 192.168.3.255
  • a /22 : 192.168.4.0 to 192.168.7.255
  • a /21 : 192.168.8.0 to 192.168.15.255
  • a /20 : 192.168.16.0 to 192.168.31.255
  • a /19 : 192.168.32.0 to 192.168.63.255
  • a /19 : 192.168.64.0 to 192.168.95.255,
  • a /20 : 192.168.96.0 to 192.168.111.255,
  • a /21 : 192.168.112.0 to 192.168.119.255
  • a /24 : 192.168.120.0 to 192.168.120.255
| 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.