Port Forwarding

When one computer needs to connect to another computer in a TCP/IP network environment they use IP address and port to establish the connection. IP address identifies a computer on the network while port specifies a virtual socket which is used for a connection. The concept of ports is very useful because it allows for multiple connections to be established to a computer. For example, a single server can have a web server running on port 80 and FTP server running on port 21 at the same time. When a remote computer needs to connect to the web server it will use port 80 and for FTP server connection it will use port 21.

Port forwarding is very useful in cases when you have a private network which has only one external IP address assigned to it. It means that any computer which needs to connect to that private network from outside can do it only via that IP address. But what if there are dozens of computers on the network and they need to be accessed externally. That is when port forwarding comes handy.

With port forwarding enabled router establishes a match between an external port and an internal IP address inside the private network. It will forward all external traffic coming to the port to an assigned IP address and vice versa. This means that when an external computer will need to access a port forwarded IP it will connect to a private network IP with a port which is forwarded. Any request made from outside the private network to that port will automatically get forwarded to an internal IP address which was set up in port forwarding. For the external user, it will look like a connection made to a private network IP with a specific port. The internal computer will not be visible and all forwarding will be done internally by the router.

Port forwarding setup is performed inside a router. There is a specific section in a router config which allows mapping one or many ports to a specific IP address.

Port forwarding could be used in many applications like accessing your CCTV cameras, game server, remote desktop remotely.