What is a Network Port and why do I need one?
Mục Lục
What is a Network Port and why do I need one?
Network Ports can often be a difficult concept to understand. When working with IP cameras you don’t really need to worry about them until you have to set up remote access. Routers rely on ports to limit data which can access your camera and differentiate between multiple devices. Believe it or not, you are using a port just now, only you can’t see it.
What is a port?
A port is simply a channel of communication which is numbered between 1 and 65000. All network devices use them and most have the ability to change them when required. They were originally created to allow multiple programs to use the same IP address.
The best way to understand ports is to think of the postal system. When sending a letter, you need a street and a town name. When a letter is sent the first thing that is read is the town name. Letters are then dispatched according to town. Once the letters get to the town sorting office the street address is checked and then the correct letter is sent to the correct house. The same is true with IP cameras. IP cameras have multiple services built-in, such as FTP servers (Port 20/21), web servers (port 80) and email clients (Port 25/110).
Web server ports
When you access the (HTTP, port 80) web interface on your camera, you type http://IPADDRESS/ into your browser window. What most people don’t realise is that when they do this their browser automatically looks for http://IPADDRESS:80/. All websites on the Internet use port 80 so rather than have you type this in all the time, your browser assumes that because you are using http, you mean to use port 80 and appends it to your address. If you were to type in “:80” after a website address you will still see the site as normal.
By default, IP cameras use port 80 for their website interface. However, in the settings page of most IP cameras you have the option to change the web port from 80 to something else. If you were to change the port from 80 to 81, you would no longer be able to access the web interface just by typing the address in and would need to specify the port number, for example http://IPADDRESS:81/. If you can still access the camera then why would you ever need to do this?
Why do I need one?
The most common reason for needing to use ports is for remote access. Imagine that you have two cameras on your network, connecting through the same router (your router has a single external IP address which is accessible from the Internet) and you want to be able to connect remotely to both your cameras which are both on port 80.
You decide that you want to access your cameras from the Internet and so set up port forwarding. However, you can’t forward a single port onto more than one local IP address at the same time. As such you can’t access both cameras simultaneously when they’re both using port 80.
The solution is to use two separate ports. In the case above you could use port 8000 for the HTTP port on one camera and 8001 for the other.
To access your cameras from the Internet you would then type http://IPADDRESS:8000 and http://IPADDRESS:8001 where the IP address is the external IP address of the router.
You must make sure to type in the http before the address. Your browser will know that any information on port 80 is to be displayed as a web page but because you are using a different port number the information could be just about anything. Adding the http:// tells the browser that the information received should be displayed on the screen.