3

Hy there,

I was wondering if it is possible to have two different networks connected on one router who which have the same ip, and are differentiated by a subnet mask?

For example:

192.168.1.0/24 192.168.1.0/16

Are they considered different because their network prefix is different?

Does that mean that with the ip address 192.168.1.0 we can actually address.

192.168.1.0/31 -> 2 computers - 2 (for broadcast and network name)

+

192.168.1.0/30 -> 4 computers - 2

+

192.168.1.0/29 -> 8 computers - 2

+

...

Does it mean that we can uniquely define adresses for, what ever the number turns out to be, computers?

1
  • Great question, I think a lot people make this assumption and its good to have it answered here authoritatively. Sep 24, 2012 at 19:29

1 Answer 1

7

No, it does not. The subnet mask is used exclusively for routing decisions (the routing algorithm needs a hint what hosts are local and what needs to be sent to a gateway), the addresses have to be unique in any case.

See also: http://en.wikipedia.org/wiki/IP_forwarding_algorithm

But you can set the netmask arbitrarily to match your requirements on subnet size, of course.

There are also techniques (mainly NAT) which would allow two networks with overlapping IP address spaces to communicate by remapping the overlapping address spaces to unique ones. In your example, with two separate networks A and B both including subnets of 192.168.1.0/24, the remote subnet 192.168.1.0/24 could be presented as a different, not yet used subnet - e.g. 10.0.1.0/24. The router would perform the necessary address translation operations forth and back to re-establish address uniqueness as visible by each of the networks A and B.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .