How to ssh port forwarding in router – Step-by-Step Guide for Beginners

ssh port forwarding in router

Hello friends, Welcome on my blog

This article will cover scenario of port forwarding, what is port forwarding and How to ssh port forwarding. I will describe about ssh port forwarding you can do for other services as well.

Scenario Of SSH port Forwarding

ssh port forwarding in router

I have run an SSH server at my office and the LAN IP address is 192.168.0.3 and the Wan IP address is XXX.83.2.35. I have another laptop at my home, it has putty ssh client installed on window 10. I tried to access my Office ssh server from home by using the servers’ LAN/WAN IP address but failed. because the problem is there LAN IP address is only accessible from the LAN network. but later I found ssh port forwarding can solve this problem. After ssh port forwarding in my office router, I was able to access ssh server by using my home laptop. So in this article, I am going to describe each and everything related ssh port forwarding

What is port forwarding?

Port forwarding is a process that redirects a communication request from one IP address and port number to another IP address and port number through a router or firewall. 

After the port forwarding the request for SSH server on WAN IP address at the office will be redirected to the local IP address of ssh server at the office. It means now I will be able to access the office ssh server from my home laptop. Not Only SSH service, but you can also port forwarding for any service such as HTTP/HTTPS, FTP, Telnet, etc.

How to setup ssh port forwarding

In this section, I am going to tell you about how to set up ssh port forwarding. for the port forwarding, you must have access to the router where you want to redirect requests to another local computer, So you can set up the ssh port forwarding. The most different router has different methods to configure for port forwarding, but all the processes are the same. I am using a TP-LINK router so I will describe each and everything on the router.

You should follow the giving instruction for ssh port forwarding:

  1.  First I am going to check the status of running ssh server at local machine. I am going to access local ssh server by using putty ssh client. In the following image you can see “ssh server is running on local computer. ssh server on local computerBut at the same time when I am trying to access ssh server through WAN IP. I get the error. See in following image
    Check ssh server by WAN IP
  2. Access Router: Access the router by browsing the router IP address through web browser. Enter the correct username and password for accessing router’s configuration page.Access router by IP Address
  3. Click on Forwarding > Virtual Server and fill the required fields, and save.ssh port forwarding configuration
  4. After click on save you can see you have added on entry of virtual server.entry of ssh port forwarding
    You can see here is two options one for modify entry and another for delete. if you want to modify port forwarding click on modify. if you dont want port forwarding any more click on delete and delete the entry.
  5. SSH port forwarding Check / Test: Now again try to access ssh server through WAN ip address from your home laptop. and you will get success this time.check ssh server on local computer

If Appreciate My Work, You should consider:

11 thoughts on “How to ssh port forwarding in router – Step-by-Step Guide for Beginners

  1. Hey, Mr. Kumar:

    Thanks for your explanation!

    But maybe your explanation is not complete, the title “port forwarding” should mean that it makes a forwarding with the port number, not the WAN IP address.

    For SSH port forwarding, the SSH connection using port 22 as showing in above figures, when you want to connect the SSH server with its WAN IP address from the SSH client on your home laptop, the SSH client will send the service request with port 22, and when your office router received the request it will respond with the port number in service request, because we set up the router port forwarding as service port 22, the router will forward the request package to internal port 22 with the local IP address 192.168.0.3 (or you used 192.168.0.103) that set in router’s port forwarding rule.

    If I am wrong please correct me, thanks!

    1. Exactly, No doubt you are right.
      All the traffic for 22 port on a router, will be redirected on mapping local IP address.
      Similar you can forward other services,
      It is good for those who don’t have a dedicated IP address, they have multiple servers on a single IP address.
      It is so useful.

Leave a Reply

Your email address will not be published. Required fields are marked *