Imagine I have two networks:

192.168.20.0
192.168.21.0

How can I find the common supernet to give to a router so any external router can access these two network by using only the supernet address?

link|improve this question
Please, Please, Please! Read this question and the first answer (top to bottom) before asking any more IP questions: serverfault.com/questions/49765 – Chris S Aug 27 '10 at 13:11
Strictly speaking you have not given two networks, you have given two IPv4 addresses. Your question should have been; Given IP addresses 192.168.20.0 and 192.168.21.0, what is the minimum network possible that will include both. The answer is 192.168.20.0 /23. – dbasnett Aug 28 '10 at 11:49
A more difficult problem would have been; Given IP addresses 192.168.21.0 and 192.168.22.0, what is the minimum network possible that will include both. – dbasnett Aug 28 '10 at 11:52
feedback

3 Answers

up vote 4 down vote accepted

Convert to binary:

1100 0000.1010 1000.0001 0100.0000 0000
1100 0000.1010 1000.0001 0101.0000 0000

look at how many bits they have in common:

XXXX XXXX.XXXX XXXX.XXXX XXX0.000000000

Count them up for CIDR notation; or convert to decimal for the subnet mask:

CIDR:192.168.20.0/23
Mask:255.255.254.0
link|improve this answer
Eggs-cellent. Thanks again. – Sergio Tapia Aug 27 '10 at 13:24
feedback
#ipcalc 192.168.20.0 - 192.168.21.255
deaggregate 192.168.20.0 - 192.168.21.255
192.168.20.0/23
link|improve this answer
feedback

Work in binary, you will see the subnet which contains these two networks. Or use a mask calculator like mine http://dominique.fournier38.fr/?prog=CalculMasque&line=1 in french sorry)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown