Networking

What happens Same IP Range different subnet mask

I had this question posed to me the other day and it is one of those curiosity questions that you may have asked before or perhaps had a situation that presented itself that gave cause to thinking about this question.  What happens same ip range different subnet mask?  And more accurately, what if you have (2) ip addresses that overlap each other or would in one of the subnets?  Will the same router be able to service and ping both as well as carry pings for both?  Well, let’s see.

What happens Same IP Range different subnet mask

Let’s quickly go over the setup which I thrown into Packet Tracer as a quick test config.  So let’s say that the first IP address, 192.168.0.2 has a subnet mask of 255.255.255.0.  The other IP address is 192.168.1.2 and has a subnet mask of 255.255.254.0.

The IP 192.168.0.2 would fall in the range of the subnet configured on the 192.168.1.2 address.  Would it be able to ping the other IP?  Also, would the same router have problems routing traffic between those two hosts?

Notice below the different IP addresses as well as the different subnet masks.

PC1

diffsub02

PC2

diffsub03

Router

diffsub04

What happens?

When the IPs and subnet masks are configured as above, both IPs will be able to ping the router IP and the router will be able to correctly return traffic back to both hosts as the IP and subnet on the router spans both IP ranges and is a summary route of sorts for both.

As you can see below, the first PC configured with the /24 subnet is able to ping the router and get pings back successfully.

diffsub05

Also, the second PC configured with the /23 subnet is also able to ping and get pings back successfully from the router.

diffsub06

What doesn’t work

One thing to keep in mind is that this only works because we are using different IPs configured on the PCs.  If we tried to assign the same IP address to both PCs even though the subnets are different, the traffic would not know how to get back to the proper PC that is configured.

Thoughts

So while in practice, this IP addressing works with the different subnets, and could even be used to segment traffic to some degree with one router, this is less than ideal because of the issue of duplicate IP addresses.  If the same IP address is purposely or inadvertently configured on either subnet, the communication to both will be broken.

Subscribe to VirtualizationHowto via Email 🔔

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com and has over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, Brandon has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.