This article explains the concept of port forwarding on router and and example where you can implement it.
Port forwarding is a feature which is inbuilt on a router. It allows to forward traffic to a specific application residing on an internal system. The below example shows the use of port forwarding
Port forwarding example
A home user need to access a PC in the home network from his office. Windows remote desktop is enabled on the PC. The user, when at office, cannot access the PC directly since the PC does not have a public IP address. The public IP address is available only on the router
In this scenario, port forwarding is used. Port forwarding feature is enabled on the router
The LAN IP address of the PC is 192.168.0.5 as shown in the screenshot. Remote desktop works on TCP port 3389. This port number is configured as the internal LAN port number. The WAN port is the port on which the router receives the request. This also configured as 3389.
How port forwarding works
The following are the steps used to connect to the PC in the home network after port forwarding is enabled.
1. The user in office opens the remote desktop client on the PC and connects to the public IP address of the router. The public IP address of the router can be found out by logging into the web interface. The default port number would be 3389.
2. When the request reaches the router, the configuration setup on the router would forward the request to the internal server with the IP address 192.168.0.5 to the port number 3389. This would establish a remote desktop connection between the user in office and PC at home.
Port forwarding is a feature which is available on most of the routers. The feature is used in scenarios where a PC or any other device on the internal network needs access from a remote location. Any application supporting TCP or UDP can be accessed using port forwarding feature.