MacOS – Why can’t I connect to local devices via VPN when IP subnet is the same between both networks

macosNetworkvpn

I have a VPN server running on my home network that I can connect to fine. The local IP subnet is set to 10.0.0.1 with the subnet mask set to 255.255.255.0. This works fine.

When I'm on a friends network, they have the IP subnet set to the same value as mine. In this case I can connect to my VPN fine (doing an IP check online shows my home IP), but I'm unable to connect to any local device.

If the friend changes their router settings to use 192.168.1.1 with a subnet mask of 255.255.255.0, everything works perfectly (and I'm able to connect to my local devices on my home network).


It almost seems like when the IP subnet is the same, there is a conflict where it will prioritize sending it to the local network instead of sending it through to my VPN connection. I have verified that all of my traffic is set to send over the VPN connection.

Send all traffic over VPN connection is enabled


Is there a way on macOS to fix that so that no matter the local IP DNS subnet of the network I'm connected to I'm able to access my local devices on the VPN network?

Best Answer

In your Mac's network settings, the local network is probably set to 10.0.0.0/255.255.255.0, this means that all IP addresses from 10.0.0.1 to 10.0.0.255 are local. The option "Send all traffic over VPN connection" does not help here because it affects only non-local traffic.

What you might try (but I would not recommend it) is to change your Mac's network setup to manual, then change the network mask, so only your friend's router is left in the local network. Assuming the router has 10.0.0.1, then the mask should change to 255.255.255.254 to route all other IP addresses through the VPN. Note that this makes it impossible to reach any other device in the local network. Note also that this setting cannot work when you are back in your own network. Finally, note also that this is a theoretical solution which I haven't tried, and it may well be that it causes other problems that I'm not thinking of.

The correct and recommended solution would be that you change the IP range of your local network to something more unusual that is unlikely to collide with other local networks, like for example 10.99.111.0/255.255.255.0. This is how I solved this problem, and I've never had any network collisions any more, even though I've used VPN from many different networks in other companies, hotels etc.