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
PC2
Router
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.
Also, the second PC configured with the /23 subnet is also able to ping and get pings back successfully from the router.
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.