IP security cameras have become part of our daily lives. As security camera owners, we like to see the feed or snapshot of live video on our phones, remote computers, and many other places. In order to accomplish that, we need to do a configuration on our home routers or modems that is called port forwarding. We will get into port forwarding tutorial’ for many known brands, but in this article we would like to delve into the definition of port forwarding and how it came about. Have you ever wondered what port forwarding actually stands for? Why do we need to configure port forwarding when we want to access our security camera in our house or at our business? We wondered about these questions and put together this guide for those who would like to learn about the computer networks we use every day.
If we take one step back and look at the reason we are needing port forwarding, there is a quick and also very detailed explanation. We would like to explore this term in detail to give you a better insight about networking and port forwarding.
When Internet Protocol version 4 (IPv4) designed back in 1980, the engineers at IETF had no idea that internet would become what it had become today. According to their calculations, 4 billion IP addresses were way more then what would be their hypothetical limit if mankind would ever reach. In old days, you could assign each computer on the internet with their own IP address and that machine would be reachable by anybody on the internet instantly.
Fast forward to today, we have millions of computers, printers, cameras and networks connected to internet all over the world thus we are limited with how many IP addresses we can be given by our internet service providers (Timewarner, AT&T, Verizon etc.) These IP addresses are called public IP addresses. Everybody who would like to access to internet needs to have a public IP address. These IP addresses are divided into two categories: Static IP addresses and Dynamic IP addresses. Since ISPs are limited with the amount of IP addresses they can own, they allocate pools of public IP addresses and they assign these IP addresses their customers by changing it at random time frames, these IP addresses are called Dynamic IP addresses. If you would like to have static IP address that is solely assigned to you, and does not change in a day or a week, that option is likely available to you by making a phone call to your ISP.
Due to the allocation limits of IPv4, our home and business routers get assigned one IP address and all the computers behind that router use this IP address to access the internet.
Magical Network Device known as 'Router'
Although we are given one public IP address, we have many devices that we want to connect to internet. There comes the magic device called a router, or as many home users call it a modem. These devices remove the barrier of one public IP address and allows every device access to internet. How does the conversation between router and our computer take place? Say, you would like to access to www.yahoo.com on the internet, your computer would put forward a request to the your home router saying “I cannot find any computer called ‘www.yahoo.com’, can you please look around you and see if you can find me this computer?” and your router would then take this request and hands it over to its neighbor which is your ISP's router. This step basically takes you to “internet highway” and once the demanded data arrives back from your ISPs router to your router, it then hands over the information to your device.
What is Port and Port Forwarding?
With the same approach, when you would like to access to a device in your home network from internet, you need to make configurations on your home router. This is what we now call port forwarding. Before we get to port forwarding, let's look at the definition of port. We are given a list of virtual addresses that are called "port" that each of them is mapped to a software or service running on your computer. In other words, if you would like to send or receive data in your network, you would need a port number for both outgoing and incoming. Each device that is connected to an IP network will have 65,535 ports on them by default. Say you would like to access to a computer, you would have to know that device's IP address as well as the port number that your software is running on. If you only know the IP address but don't know the port number, you can only 'ping' the device but you cannot access to any software service on it. We can use the analogy of street address. 123 Elm Street. In this case, "Elm Street" would refer to IP address and house number would refer to the port number. You may know the street name but if you do not know the door number, you are basically clueless for the final destination.
How does Port Forwarding work?
When you would like to access to a device from internet, you would go on to your router and identify the port number that you would like to access from internet. For example, our router has the IP address of 126.96.36.199. We have a device behind this router that has IP address of 192.168.1.20 which has a program listening on port 80. We would then go on to our router and make the following configuration:
When somebody on the Internet requests information on my port 80, I will take this demand and hand it over to 192.168.1.20 on port 80. Whatever the response is, I will then send it back to the device requesting.
Internet ---> 188.8.131.52:80 ---> 192.168.1.20:80
Internet <--- 184.108.40.206:80 <--- 192.168.1.20:80
Port Address Translation (PAT)
In more advanced routers, you can define what’s called as ‘port address translation’ or PAT. In this case, the port numbers from outside of your network do not have to match the port number on your device. You can assign whatever the port number you would like to define on your router then assign it to your internal device’s IP address and port number.
Internet ---> 220.127.116.11:8000 ---> 192.168.1.20:80
With this, we conclude the definition of port forwarding.
Please send us any questions you might have about port forwarding.