Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|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
add comment

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
share|improve this answer
    
Eggs-cellent. Thanks again. –  Sergio Tapia Aug 27 '10 at 13:24
add comment
#ipcalc 192.168.20.0 - 192.168.21.255
deaggregate 192.168.20.0 - 192.168.21.255
192.168.20.0/23
share|improve this answer
add comment

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)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.