# How to find the common supernet between two networks?

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?

-
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

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
``````#ipcalc 192.168.20.0 - 192.168.21.255