My 20-year-old home control computer is on my LAN and has incoming port forwards for remote access. My iPhone can access it either way, but I have to stop and think which connection it is using, so which setup to select. If I walk too far out in the yard while it is on Wi-Fi and it switches to Cellular, the connection drops.

I've been solving this by keeping the phone on a second Wi-Fi with a second WAN connection, so the phone could use the same target IP regardless of the signal path. But that WAN is no longer available.

I fantasized about a static route that would grab a LAN request for the computer's specific forwarded port at the WAN address, and redirect it locally to the computer's LAN address. So the phone could request like it was on the internet even if it was on the local LAN. But apparently it is impossible to set up a static route where any part of the destination is shared with the WAN, even if you have more control than my router offers.

How do people deal with this? Is there some VPN or virtual network trick? Or maybe most IoT users don't care about access outside their Wi-Fi bubble? My system controls pumps, irrigation, water treatment, and sensors spread over several acres - well beyond my Wi-Fi reach. In Android I could imagine a smart tool that would switch network addresses when the connection method switched, but in iPhone?

1 Answer 1


It sounds like you need what is called "hairpin" NAT (wikipedia link). This is a capability of your Home/Office router. This means that if you try to connect to the WAN/ISP side of router from inside your network it will "turn round" the request and follow the port forwarding rules to access the internal service.

With this in place then you would configure your app to always connect the external address.

The other option is to look at a VPN solution, in this case you would always connect to the internal address. I've not looked at iPhone VPNs but it should allow you set it to autoconnect when on the cellular network (I believe the OpenVPN app may support this option). If you set up the right subnet options then it could just route connections to your controller over the VPN rather than all traffic.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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