Dynamic DNS address only works externally

07
2014-07
  • vext01

    This is a problem which is driving me crazy lately.

    I use dynamic DNS to connect to a home server. Let's call the dynamic host my.home.net. I use ddclient to update the DNS record every few minutes, then I access my machine over SSH. Pretty standard. That works great when I am out and about, but I cannot access my server using the dynamic host address when I am inside my home network.

    The upshot of this is that I often find myself configuring everything twice. For example I have git repos on my server and I end up adding two remotes, one for external access via my.home.net and another for internal access via local IP address.

    This is annoying, so I hope to fix it. Something tells me this is the fault of my DSL router's DNS implementation, but I am not sure. I have prodded around in the router setting and I don't see anything that could help.

    Has anyone had the same issue? Do you know a workaround/fix?

    Thanks!

  • Answers
  • BillThor

    Routers typically don't route back to the internal servers. If you have a server running DD-WRT or a similar O/S you may be able to enable hairpin routing to do this. Your router may allow you to configure routeback which enables hairpinning.

    Your router is likely forwarding the DNS request out to your dynamic DNS provider. Some routers allow you to configure local entries, in which case you configure the domain you connect to with the internal IP address of your server.

    I generally run an internal DNS server which serves up the real (internal) IP address of my servers. bind is likely overkill and I often use dnsmasq which is easy to setup and run on Linux/Unix platforms. There are similar options for Windows. The DNS settings on the router should be updated to use this server rather than the default one. DHCP can be configured to specify the internal DNS server as the default.


  • Related Question

    Use Dynamic DNS to access Java servlet, still need port forward?
  • Frank

    If I use Dynamic DNS such as the free service at https://www.dyndns.com, do I still need to set up static IP and do port forward ?

    I have a DSL, most likely with dynamic IP address, and I run a Java servlet to get Paypal IPN messages on my notebook, in order for the messages to reach my notebook, I :

    [1] set up static IP and 
    [2] did port forwarding.
    

    But I found each time the PC re-starts, it has a different external IP, so I was suggested to

    [3] get Dynamic DNS service 
    

    like the free one mentioned above, but now I'm a bit confused, if I have step [3], do I still need to do [1] and [2], isn't step [3] supposed to do [1] and [2] for me ? But since I've already done [1],[2], now I wonder if they would cause trouble for step [3], do I need to undo them ? Or do I need all of them together ?


  • Related Answers
  • marcusw

    If you are going through a router, you need to set up a static internal IP address for your computer and forward to that from your router (which can have a non-static external IP). If your computer is connected directly to the internet, you do not need to set up port forwarding.

    I might also add that most routers have integrated support for dyndns clients, you just need to enter your login/password for your dyndns account somewhere in your router's web interface and it will update the dyndns server with its new IP address whenever that changes.