

To set up the port forwarding, you will have to access the control panel or interface of the router. Most modern routers support port forwarding. This way the router will know where (or which IP address) to send the traffic to when the connection requests from outside networks are asking to connect to that specific port. The idea is that you will specify the port number for the service and tie it to the IP address of the server in your router or the gateway. Port forwarding is also known as port mapping. This is where the concept of port forwarding comes in handy. However, your router has no way of knowing where to send this data forward. Now, if you were to initiate a connection from the outside network or the internet, the connection will come to your router at first using the public IP of the router. Imagine you have a home server set up in your home network, and you want to connect to the server from outside of your home network.Ĭhances are, your home network will be hidden from the public internet because it is behind your router, and the router will have the public IP facing the internet. In simple terms, port forwarding allows users from the internet or public network to connect to a host or a server that is behind a router or a firewall within a private network. Port forwarding is a kind of network address translation in which packets are redirected from one IP address and port combination (socket) to another while passing through a network gateway – a router or firewall. This means the SSH application/service runs on port 22 by default and all the data received or sent by the SSH application/service comes to or goes out from port 22. For example, the SSH service has a default port of 22. These network endpoints are made with the IP address and the port is called a network socket.ĭifferent applications/services have different ports that they use for communication. In short, the IP address and ports work together to create a network endpoint that sends and receives data from other network endpoints.


If you want to learn more about ports and understand how they operate, take a look at this article on IP addresses, basic concepts and terms explained. The operating system creates different logical ports for different applications/services to communicate over the network. Since we want to cover port forwarding in this article, you must know how the ports function, why, and how port forwarding is done. When to use the Dynamic Port Forwarding?.When to use the Remote Port Forwarding?.Remote Port Forwarding or Reverse Tunneling.Types of SSH Tunneling or SSH Port Forwarding.
