0

I have a dynamic DNS name for my router to access my server via port forwarding from the Internet. When I am at home at the local network I can also access this server by its local name or IP address.

But for convenience I would always like to use the same name.

However, using its fully qualified domain name for looking up its dynamic IP from a DNS server requires access to the Internet and hence I cannot reach my local server when the Internet is down. Another disadvantage is that when working at home I could not close my router for outside connections, since I depend on its port forwarding in order to access my server.

So I am wondering what is the best way to use only one name for a server when changing between a local network and the Internet.

1 Answer 1

1

When you access your server over the Internet there are at least a few hops involved. Even if an extra hop is added when assessing it locally there will still be less latency than when accessed from the Internet, so there's probably little reason to change anything.

But for best performance, you can edit the HOSTS file on your local computer(s) to permanently map your dynamic DNS name to the corresponding internal IP address. This is fine for machines that never leave the LAN to access your server remotely. Don't do it on a device (e.g. laptop) that you take off-site and need to connect to your server because it will still try to use the server's internal IP, which won't work.

3
  • From the point of latency I agree. But in terms of stability and security it would make a difference. For example if my internet connection is down, I wouldn't be able to resolve my server's IP address and access it. And when working at home I would still need to keep my router open for the port forwarding to access my server. Commented Nov 1, 2017 at 14:33
  • 1
    I agree on the point of losing access if you cannot resolve the DNS name. That's another argument for using the HOSTS file. There should be no difference in security since the traffic should not leave the router, i.e., the router should recognize the destination IP is its WAN interface and internally keep it on the LAN interface...probably not even putting it through NAT or the firewall. Commented Nov 1, 2017 at 17:01
  • I see. Regarding security I was thinking about incoming traffic from the Internet since the router has to continue port forwarding while I want to be connected to the server. I have edited my question accordingly. Commented Nov 1, 2017 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .