Using DDNS with port forwarding to access Internet connected things

Setting up the mechanism to access your home network from the Internet is straightforward and often available as a free service.
You could simply determine the IP address your Internet service provider (ISP) has assigned and use that address from anywhere you happen to be.

This is quick and easy.

Problem is…your ISP may change this address at any time, and if you are away from the home network, it will be difficult to determine the updated address. So you become cut off from your home network.

To resolve this issue, a DDNS (Dynamic domain name server) account is needed. A DNS simple resolves a domain host name to an IP address. Using a dynamic DNS updates the IP address that the domain name points to whenever it changes…automatically.

DDNS Providers

There are both free and fee based DDNS accounts available. The following lists some of the options currently available. If you don’t like any of these, just do a google search for DynDNS providers.

Name Website Cost Description
1 DynDns http://dyn.com/dns/ $25/year One of oldest and well-known providers
2 Duck DNS https://duckdns.org/ FREE Hosted on Amazon EC2
3 NO-IP http://www.noip.com/free FREE Advanced paid plans offered
4 DtDNS https://www.dtdns.com/ FREE Advanced paid plans offered
5 yDNS https://ydns.eu/ FREE Another option
6 FreeDNS https://freedns.afraid.org/ FREE Yet another option

The instructions for setting up these accounts are typically quick and simple. You pick a domain name, one of your choice, and this name will likely have a suffix appended to it. This part is selected by the provider. This is a very small price to pay for a FREE service. Then this name gets synchronized with your current network IP. That’s it.

Setting up the router for port forwarding

You will undoubtedly have more than one device to connect from your local network to the Internet. But there is only one IP assigned to your network. So how can the traffic initiated from your DDNS domain name, which resolves to your Internet IP, know which device on your network to deliver the  message to?

Simple-Ports…

Think of the IP for your Internet connection as a post office and the ports as the individual boxes.

The connection to your device will almost certainly use Transmission Control Protocol (TCP). And TCP identifies the destination by port number. The valid range is 0 to 65535. So for each device on your local network, a port needs to be assigned for delivery of packets from the network.

The key to making this work is to configure your router to forward packets from the Internet to the intended recipient, that is, the destination port. Hence, the name port forwarding.

While this is not too difficult to set up, the step-by-step directions for port forwarding are unique for each router. That is simply because router firmwares are all different. The setup is typically found in the firewall settings. Here is how to do in with a D-Link DIR-625 router. Just 3 simple steps. 1-2-3… Your router should have similar options for setting up port forwarding:

Port forwarding a D-Link DIR-625

1. First, select the ADVANCED menu item from the initial router screen.

D-link Port Forwarding 1

 

2.Next, click on the PORT FORWARDING tab.

D-Link Router Port Forwarding

 

3. Now all you need to do is identify your local network device by IP, assign a port to it, and save your configuration.

Port Forwarding with a D-LINK Router

 

My ISP is AT&T U-verse. Setting up the router they provide for port forwarding was not so obvious, at least at first glance. Since this is such a popular home router, I am also providing port forwarding setup instructions here.

Port forwarding an AT&T NGV-589

Now the AT&T router configuration for port forwarding is a bit more tedious. I’ve broken it down into the following 8 steps.

1. Access your router’s main web portal page and select the Firewall tab.

AT&T NVG589 router port forwarding setup

2. Select NAT/Gaming.


AT&T NVG589 router port forwarding setup

3. You’ll then be instructed to enter the router access code.

portforwardatt3

4. Now, click on the “Custom Services” button.

portforwardatt9

5. Alas, we have now arrived at the screen to identify the port! Here, enter a name for your device and the port number(s) you with to assign to your device. In this illustration, I have assigned port 9701 to my second ESP8266. Click on the Add button to include this port/device(Service Name) to the router’s list.

portforwardatt6

6.The entry should now appear in the Service List. Next step is to click on the “Return to NAT/Gaming” button.

portforwardatt10

7. Now, Select the Service that was just defined (ESP8266-2) and the needed by device. You should see your needed by device in the drop-down list by the IP that it has been assigned. The device MAC is also shown on this list. Click on the “Add” button to complete the port forwarding setup for your device.

portforwardatt11

8. Your router’s “Hosted Applications” list should now display the device that you have just configured for port-forwarding.

portforwardatt12

NOTE regarding the AT&T NVG589: I have experienced issues with my router which did not allow me to access devices locally. While not universal among all users, I am not the only one to have this problem. This appears to be an issue with the router’s firmware, which did not appear to have a solution.

My answer was to use my own router and put the AT&T router in pass-through mode. If anyone has experienced similar problems, that would be my recommended solution. While using 2 routers was not particularly appealing, it does work. Allowing you to move on to other things…

In Summary

This should de-mystify port forwarding. Some routers require more steps than others to accomplish the same thing. Simple, yet this is an essential step to connecting your things to the internet.

Hope you find this information useful…

 

Share This:
Facebooktwittergoogle_plusredditpinterestlinkedintumblrFacebooktwittergoogle_plusredditpinterestlinkedintumblr
Social tagging: > > > >

3 Responses to Using DDNS with port forwarding to access Internet connected things

  1. chupo_cro says:

    Hi,

    how would you specify the port when using Duck DNS service? As I understand there is no way so only one ESP could be accessed from outside of the local network when using that service.

    • facebook-profile-picture InternetOfHomeThings says:

      DuckDns is simply used to set your designated domain (mydomainname.duckdns.org) to your router's IP.

      To access multiple devices (ESPs, cameras, etc,), your local router must be configured to "port forward" traffic. Here, you should be able to configure your unique ESP IP/port combinations to be port-forwarded.

      I currently use DuckDns to access 4 ESPs, 7 cameras and several other IoT devices from the outside world.

      You should take a look at your router settings to determine how to port forward your devices.

  2. chupo_cro says:

    Yes, but to be able to differentiate *for which ESP is the request from the outside world* there should be a port information in the request URL. For the example, if my current IP address is xx.xx.xx.xx and Duck DNS alias is example.duckdns.org and I have two ESPs acting as servers at local IP:port addresses 192.168.1.50:80 and 192.168.1.51:80 (or maybe 192.168.1.50:2000 and 192.168.1.50:2001) then Duck DNS is going to translate the http://example.duckdns.org to http://xx.xx.xx.xx, but will the URL http://example.duckdns.org:yyyy be translated to http://xx.xx.xx.xx:yyyy?

    The question is: how can router know if the request should be forwarded to 192.168.1.50:80 or to 192.168.1.51:80? It could if the URL could look like http://example.duckdns.org:2000 and http://example.duckdns.org:2500, in that case the router could forward the incoming traffic on port 2000 to 192.168.1.50:80 and incomming traffic on port 2500 to 192.168.1.51:80 but as I understand there is no way to specify port when using Duck DNS – or is it? Can you please write what the URLs to access you ESPs from outside world look like? Do they look like: http://example.duckdns.org:xxxx, http://example.duckdns.org:yyyy, …?

    BTW, I am not using a router at all, my ADSL adapter is in bridge (modem) mode and the internet connection is established by my PC (trough dial-up (PPPoE) connection), no DHCP, PC acts as a router (so I set port forwarding on the PC rather that on the router) and DNS server. Because I turned off DHCP my ESPs have static IP addresses but that is another thing, not related to my question.

    Thank you for the reply!
    Regards

Leave a Reply