Friday, April 9, 2010

Dynamic DNS Lessons

The most common question (by far) that I get via support requests is the following:

"My private camera only loads on my Wifi network. I can't reach it on 3G or on the Wifi at work. Why not?"

The reason is due to the way that IP addresses and TCP networks work. In order for your home computers and cameras to be reachable from the internet you must have a way to get to your router that hosts your home network. This can be done with either a static IP address or a dynamic DNS account. More on this topic later.

Getting there from here


If you are using Live Cams on a 3G or cell network and you want to get video from a camera at home then you will need to go through your router first. Requests for video go from your iPhone/iPad through the internet to your home router. The router then passes the request through (if properly configured) to your camera. The camera responds and sends the video back through the same way that the request arrived.

This is a fairly simple description of how the data flows, but the trick is configuring your router to pass the data through and configuring Live Cams to find the router in the first place. There are two ways to do this.

Static IP Addresses

Some ISP (Internet Service Providers) offer static IP addresses to their customers, but most do not. If you are a business then you are likely capable of getting a static IP. This is an IP address like ###.###.###.### that you can assign to your network router that will never change. Once your router is configured to use this number it is always easy to find from anywhere in the world. This is only part of the solution though, as you will also need to configure port forwarding to get data to/from your camera behind the router.

Dynamic DNS Accounts


This is probably the best way to go. Simply sign up for a free account at http://www.no-ip.com and then download and install one of their free update clients. What this does is allow you to assign a simple text-based name to your router. The update client will periodically check to see if your router has a new IP address (some ISPs do this every so often) and then it will keep the name resolution working properly.
If you selected a prefix like "egerter" and a suffix like "dyndns.tv" then your host name is egerter.dyndns.tv and this is what you would enter into Live Cams. Now the app can find your router, but we need to configure port forwarding!

Port Forwarding


This sounds scary but it's actually fairly simple. Once the request for video reaches your router via one of the two methods above it still needs to go to the camera. In your router's administrative webpages you need to find the port forwarding screen and tell it a few details:

External port - This is the port number that you will use in a webbrowser to reach your camera. If you have multiple cameras then you will need unique numbers for each. I like to assign numbers starting in the 8000-9000 range. For example: http://egerter.dyndns.tv:8000
Internal port - This is the port number that your camera is assigned to within your local network at home. It can be the same number as your external port to keep things simple. Be sure that your camera is configured to use this HTTP port.
IP Address - This is the IP address of the camera within your local network, like 192.168.1.100
Protocol - TCP.

Once you enable this rule you should test the setup by entering your details into a webbrowser and see if the camera interface comes up. If everything is configured properly then a URL like this:

http://egerter.dyndns.tv:8000

will go out to the internet, look up the router from the dyndns servers, then reach your router on port 8000. The router then looks up port 8000 in the port forwarding rules and sees that it should send TCP data to a local IP of 192.168.1.100 (your camera). Voila, video!

Within your local network you can also reach the device using the local IP address and internal port:

http://192.168.1.100:8000

Conclusion


If you are reading this paragraph I commend you for sticking with it. This article is fairly wordy but there are really only two basic steps. First you get the requests to find your router, then you get the router to pass it to the camera. Live Cams does not need to be involved in this equation until you can successfully reach your camera via a standard web-browser using either the dynamic DNS account or the static IP address. I configured 7 cameras at my home (each with different ports) before travelling on vacation this winter and the result was that I could check in on my property via Live Cams while in another country!

Don't be discouraged if it doesn't work the first time. Focus on each step separately and try to get the configuration working before you involve Live Cams in the mix!

Barry