IP Device Programming
DDNS for Fun & Profit
In general, people don’t like things to change, and they’d like them to remain the same. When we propose to provide IP-enabled security devices such as cameras to our clients, we most likely don’t want to force the customer to change their ISP service.
Most small businesses and residential clients will purchase the least expensive “broadband” connection they can get from their telephone or cable company. These low-cost Internet hookups almost always receive their public IP address from the ISP’s Dynamic Host Control Protocol (DHCP) server. This means that the public IP address at that location can change at any time, whether because of a momentary power outage or just the quirks of the ISP. While the customer can probably upgrade their Internet connection to provide static public IP addresses, this is an expensive option that might cause the client to decline the installation of the IP security devices. Any change that is going to cost the client in time or cost is probably a deal-breaker.
DHCP public IP addressing causes a major problem if the security contractor has sold the customer on the concept that the client can access/view/control IP-enabled security devices from over the Internet. If the public IP address has changed, where did it go?
If there is a person available at the target site that has Internet access through the same LAN that the security devices are connected to, then it is a simple matter to obtain the current public IP address. All the person has to do is access a web browser like Firefox or Explorer and type http://www.whatismyip.com, and their current public IP address will be displayed.
Of course this doesn’t solve our problem when Mr. Murphy arrives and changes the dynamic public IP on Saturday morning, when no one is available at the target location to manually retrieve the new IP address. So do we force our clients into changing their Internet service to provide a static public IP address? The answer is “Noooo”!
Dynamic Name Service (DDNS) is an Internet function that’s been around for years and provides a fairly simple way to track a changing public IP address at a client’s location.
DDNS works just like your cell phone — provided you didn’t dip it in the muck of the lake. Your cell phone lists contact names and phone numbers so that you don’t have to remember a numeric telephone number, you can just push the right button(s) to call your family, friends, office, etc. DDNS is an offshoot of Domain Name Service (DNS) which is basically an Internet address book that relates URL (Universal Resource Locator) names such as www.google.com to their true numeric public IP address. What makes DDNS service unique is that the user can select his or her own URL name, and have their dynamic IP addresses recorded on the DDNS server so that when a user inputs the URL, the communications are forwarded to the correct public IP address.
I’ve used the DDNS service from www.dyndns.org for more than eight years, and not only is it free but it works great. Instead of having to remember a string of numbers all I have to type into a web browser to get to the cameras and devices on my LAN in Chicago is http://davee.shacknet.nu, along with the appropriate software port number of the device I’m shooting for at that moment and I’m immediately hooked up to my NVR, individual cameras, or my router at home.
All a new user has to do is go to the dyndns.org website, register as a user, obtain a user name and password, and input a unique name for a particular public IP address.
Once dyndns.org has informed you via e-mail that the address you input is unique in their system, you can then input the current public IP address of the client’s location, run a test, and you’re good to go — at least until the public IP address of the client’s location changes, which is when the programming tricks come into play that will keep the DDNS service updated to the changed IP address.
The DDNS service cannot know if a public IP address has changed by itself; there must be a device or software on the same public IP connection as the target device(s) that will detect that the public IP has changed, and will automatically update the DDNS service with the new address. This device could be the router, or possibly the camera/encoder/NVR itself, or a PC on the network. Many vendors provide their own DDNS service that can be initiated within an IP camera, DVR, or what have you. But you need to be very careful if you try to use the DDNS service that is built into a security device.
What is critical here for you to understand is that the device that does the updating must see the true public IP address, not just the default gateway to the next network.
If you ask an IP-enabled security camera installed on a typical LAN what the public IP address is for that Internet connection, the camera would reply with the default gateway address — for example, 192.168.1.1. The camera thinks that is where the Internet is because that is the path it takes to get out of the LAN and onto the Internet. It’s like if you ask me how to get to New York from downtown Chicago: I would tell you to drive southwest on the Stevenson Expressway. But, you say, New York is east of Chicago, so what are you saying, Dave? I said you drive southwest on the Stevenson to get to Midway Airport and fly to LaGuardia. That’s my path to New York.
It’s the same with IP cameras, encoders, and other security devices. Let’s look at the diagram here to see how the IP addresses are set in a typical home/small commercial LAN.
As you see here, the router does not see the true public IP address; instead its path to the Internet goes through the local address of the DSL adapter, 172.16.1.34, and only the DSL adapter sees the true public IP address. While the router can be programmed to automatically update dyndns.org, it won’t work properly because it doesn’t see the real public IP.
The work-around for this very common issue is to use an “updater” software program that is available for free from dyndns.org. Once downloaded it should be installed onto one of the client’s PCs that is turned on and used daily. When properly programmed with the correct URL, user name and password, this software will continually check the public IP address and if it changes it will automatically update dyndns.org and everything is a go. Functionally the updater software is performing the www.whatismyip.com trick every few minutes. I have this program on my desktop PC at home, and it works pretty much perfectly.
Save yourself and your clients from having to remember a numeric public IP address and provide them with automatic updating when their DHCP ISP Internet address changes. You need to try this service yourself from your home or office and get comfortable with it. Try it and you’ll be a believer.