This is a problem that I’ve been trying to crack for a long time now. I want to be able to access my home network remotely. The problem seems simple enough, but there were a number of roadblocks stopping me from doing this.
Firstly, my Internet connection at home has a dynamic IP address. This means it’s hard to target it because the IP address changes regularly. The solution to this is to use a Dynamic DNS service. The way these services work is to run a utility in the background on your computer and report its current IP address back to the Dynamic DNS service. It ties this IP address to one of its own domain names or a custom domain name that you ascribe to them.
I started to pursue this option. I purchased my own domain name and got an account at Dynu, one of several free dynamic DNS services and attached my domain name to it. I installed the IP Update Utility on my home computer, added my account credentials and successfully started reporting my IP address back to Dynu. However, there was a problem…
My computer is always connected to a VPN. Thus, whenever the IP Update Utility retrieved my IP address, it was getting the IP address of my VPN, not my public IP address. Thus, if I tried to use that to access my home network, I’d instead end up at the servers of my VPN service.
This was a hindrance for me for a long time, but today, I decided there must be a way around it, so after a lot of research, asking questions and trial and error, I found the answer.
The answer is to add your Dynamic DNS service’s IP addresses to your route table. This tells your computer that traffic to your Dynamic DNS service should go straight to your router (unprotected), rather than through your VPN. Thus, the dynamic DNS service gets the public IP address of your router, as you want it to.
I have Macs, so my instructions are for macOS, but if you have Windows, this is how to add a static route in Windows.
Once you have the IP addresses of your dynamic DNS service, use the following command in Terminal where 22.214.171.124 is the IP address of your dynamic DNS service and 10.0.1.1 is your router’s local IP address:
sudo route add -net 126.96.36.199 -netmask 255.255.255.255 -gateway 10.0.1.1
For the record, if you use Dynu, the IP addresses you need to do this for are:
Once you do that, the next time the IP Update Utility sends an update to Dynu, you should notice that the IP address has changed to your public IP address.
With that, you can now effectively target your home network to allow you to remotely connect to your computers and files.