Port Forwarding and Dynamic DNS

What and Why?

These geeky phrases allow you to access something that is on your home wifi from the Internet while you are away from home. You might want to watch a security camera while you are away from home, or listen to the music collection that is on your home computer, etc. Note that you can only do this with "network apps" that are set up to send things out over the network, like webservers, media servers, etc. Check the instructions for your app to see if it can do this. I'll try to keep things simple, but this will be slightly technical. To do this, you must be able to do these things:

  1. log into your home wifi router and change a setting.
  2. be able to install an app on a computer you always leave turned on in your home.

Every wifi router out there is different. I will tell you what settings to look for, but you will need to look up the features and instructions for your specific router model.

What is Port Forwarding?

Every time your computer, phone, or tablet connects to any network, it gets assigned a new IP address by the network. This lets the network keep track of all the devices connected to it. Every app on that device, which send stuff out to the network uses a different port number. So, IP address = the computer, phone, or tablet. Port number = one app running on that device.

How to Set Up Port Forwarding

When you are home, connected to your own wifi, you have one IP address. When you leave and go away from home, you have a different IP address. This changes every time you go somewhere and connect to a network again, whether it is wifi or a cellular data plan. Port forwarding is telling your router (which acts like the Great Wall of China around your in-house home network) that every time someone from the outside world tries to connect to it using a certain port, send that over to a specific app on a specific computer, phone, or tablet on your home wifi network. To do this:

  1. Open a web browser on a computer that is plugged into your router with an ethernet cable, NOT one that is using wifi to connect.
  2. Type the address for your router into the web browser. This is usually http://192.168.1.1 (but not always).
  3. I'm assuming that you already know how to use your router, and that you set up a user name and password of your own when you bought it. You should get boxes that ask for that username and password. Most brands of routers have a default of something like "admin" for the user name and "password" for the password. You should change these to something no one else knows, that includes numbers and letters.
  4. The router's internal settings web page will open. There might be a lot of tabs or menu items.
  5. You will need to know the internal IP address of the computer, phone, or tablet that you want to be able to connect to from the outside world.
    1. In Windows, click the start button, type "cmd" sans quotes, and then type "ipconfig" sans quotes. A lot of text will appear. Look for the spot where it says "IPv4 Address". That string of four numbers is what you want to write down.
    2. On Android, go to the phone or tablet's settings, then go to wifi settings, and tap the home network you are connected to. One of the pieces of info on that screen should be your IP Address. Write it down.

Set A Static Device IP Address

Every time you leave home and come back, the router randomly gives your device an IP address. This is different every single time you reconnect to your network. You need to tell the router to always use the same IP address for the device the network app is running on. This is called "setting a static ip". Look for something like "LAN Setup" in your router settings. You should be able to manually put in the IP address for one device that you always want it to have when it connects to your network. It should be possible to do this for just one computer, tablet, or phone, and still leave the rest automatic.

  1. Now that you are logged into your router, and the device that runs your app has a static internal IP on your home network, you need to know what port the network app uses. For example, a lot of normal webpage servers use port 80. The Android IP Webcam app I use has port 8080. Check the instructions or website for your app to see what port it uses. Write it down.
  2. Back to the router settings again. Look for a tab or section called Port Forwarding or Port Forwarding Range or NAS or something along those lines. I suggest you google specific port forwarding instructions for your router model.
  3. You should be able to enter or choose the device and enter the port number the app uses. You might have to enter the port number in two boxes. One is for the outside world (when you are trying to connect form away from home), and one is for the "inside" world of your home network.
  4. Look at your router's "Status" page. You should be able to find the WAN address. This is the Wide Area Network address, or the IP address the router has to talk to the outside world. The address you would use when away from home to access your app would be http:// then your router's WAN IP address, then colon, then the app port number. So, it might be something like this:  http://68.95.23.50:8080
    1. You can test whether this is working by turning the wifi off on a cellphone, and using your data plan to try to connect to that address.

Dynamic DNS or "My WAN IP Changes When the Power Goes Out"

Just as your router randomly gives your phone a different IP each time you connect to your home wifi, your ISP randomly gives your router a different WAN IP address each time your router connects. So, if the router gets unplugged, or turned off, or the power goes out, when it reconnects, you will have a different IP. Some ISPs even just give you a new one every week, just because they can! Looking this up every time, so that you can access something when you are away from home gets old very fast. You could pay your ISP extra money to have a Static WAN IP address that never changes, but if you are just setting up something for your own use, this is an unnecessary expense. The answer is a Dynamic DNS or DynDNS service!

  1. Look in your router settings for a tab or section named "Dynamic DNS" or "DynDNS". If you don't see this, check the manual or the manufacturers web site. Many routers have this but not all of them. If your router has this, take a look at it. Some routers only let you use the service from dyndns.com, which is not free. Some have a list of compatible services, and some will let your enter "custom" info for any service.
    1. Two good/popular free services to consider are noip.com or duckdns.org
  2. Set up an account on the service of your choice. You will get assigned an address like http://yoursite.noip.com or http:///yoursite.duckdns.org.
  3. Enter the required account information (from the service account you just created) into your router, and save settings.
  4. Use your new address with the app port number. For example, something like http://yoursite.duckdns.org:8080

What if My Router Doesn't Support Dynamic DNS?

If your router doesn't support Dynamic DNS, then you must choose a service that offers a Dynamic Update Client app. This is a small app that you install on a computer that is plugged into your router. You must always leave that computer turned on. It will send your new WAN IP address to the Dynamic DNS service each time it changes.

Conclusion

Once  you have assigned a static internal IP address to the device your app runs on (in your router settings), set up a dynamic dns account, and added that to your router (or installed the updater app), you should be set! Welcome to the world of the home server. You can do cool things like these: