This question already has an answer here:

Is it possible for two networks to have the same network IP address if two different masks are used?

Take for instance the addresses and I'm thinking that this might be problematic. Suppose a router that connects the two networks recieves a datagram whose destiny is, for example, How can it know where to send it? What path would the datagram follow? AFAIK, the host could be located in any of the two networks described above, so I don't see a solution if this is allowed to happen.

marked as duplicate by Ron Maupin Jan 30 '18 at 15:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    If it wasn't clear from the answer, having overlapping addresses is (with very few exceptions) an invalid addressing scheme. – Ron Trunk Jan 30 '18 at 15:51

There can be overlapping routes which will cause connectivity issues.

Usually a router will pick the destination with the highest bit matching precedence, in other words the route with the longest mask.

enter image description here

  • How come the destination has a "higher bit matching" with just one of the networks? I don't get that, as the destination IP could be in any of them. – Tendero Jan 30 '18 at 15:11
  • 1
    Let us ignore the first 3 bytes as they are constants and covered by both masks. Mask 24 has then nothing more to match (24 bits = all 3 first bytes), whereas mask 27 has still 3 bits to match. IP address, and for our discussion in fact its latest byte with value 3 matches the mask as in both cases, vales 0 and 3 of the last byte, share their first 3 bits (000). So IP matches "more" than – Patrick Mevzek Jan 30 '18 at 15:32
  • @PatrickMevzek Thanks for the clarification! – Tendero Jan 30 '18 at 15:37
  • We should also point out that while a router can route into and out of and by themselves, you can't route between them, i.e. from /24 to /27 because the /27 adresses appear to be local to /24 and no gateway is used (unless you work with static ARP entries, proxy ARP or even more quirks). – Zac67 Jan 30 '18 at 22:03

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