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.

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?

share|improve this question
    
Great question, I think a lot people make this assumption and its good to have it answered here authoritatively. –  SpacemanSpiff Sep 24 '12 at 19:29
add comment

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

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

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