Say for example I combine 16 existing prefixes which have '/12' netmask length, how would I calculate the netmask length of the new address?

I know how to combine 2 addresses, but not sure how to go about with this?


3 Answers 3


I know how to combine 2 addresses...

It's the exact same "power of 2" math... 2 = 2^1, so 2 /12's equal (12-1) /11. 16 = 2^4, so 16 /12's become a (12-4) /8.

In theory, in practice, the /12's may not fall on an even power of 2. [See Also: Subnet Table] x.0/12 and x.16/12 can form x.0/11, but x.16/12 and x.32/12 cannot form x.16/11 (because 16 is the middle of x.0/11)


The aggregate tool written by Joe Abley (available in Ubuntu, probably in other Linux distribution as well) can be useful:

% aggregate
aggregate: maximum prefix length permitted will be 32

Results in:

I simply write them out and work it out. As an example let's take the following few prefixes:

They all match on the first octect so no worries. You need to figure out where they match on the first different octect. In the example above we write them out and convert them to binary. Make a note of where they are the same in binary:



The above all match in the first four bits, and so that becomes the boundary. The amount of bits also tells you the slash you're going to use. You then use the 'all zeros' address as the subnet. In the above example, they all match up to the 4th bit in the second octect. Each octect is 8 bits and so the new bit boundry becomes 8 + 4 = 12.

so our end result of the above is:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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