My home PC is behind NAT but my router has static ip address. My work PC uses 3G stick for Internet (So I guess it is like being behind NAT).

I would like to create a reverse SSH-tunnel to connect to my work PC. Following lots of manuals I create a tunnel on my work PC:

ssh -R 33333:localhost:22 [email protected]

Where is my router's static IP address. When trying to connect to work from home I isssue:

ssh -p 33333 localhost

But I get "connection refused". I think I need to configure some port forwarding because I think I need to somehow make ssh let me connect some local port to my router's 33333 port to make the tunnel work. How do I do it?

Output at my work PC:

netstat -nap --inet --tcp

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *               LISTEN      1402/klient
tcp        0      0    *               LISTEN      -
tcp        0      0       ESTABLISHED 1402/klient
tcp        0      1      SYN_SENT    2366/ssh
tcp        0      0      ESTABLISHED 1402/klient
tcp        0      0       ESTABLISHED 1402/klient

Output of netstat - output at my works PC:

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0     ESTABLISHED
tcp        0      1     SYN_SENT
tcp        0      0        ec2-52-49-10-125.:53633 ESTABLISHED
tcp        0      0     ESTABLISHED
  • If your router forwards port 33333 to the pc-port 22, you should be able to connect directly via ssh -p 3333 homeuser@....
    – gerhard d.
    Apr 18, 2016 at 11:41
  • I'm not quite understanding you. I though I forward my home PC's port 33333 to my work's 22. So why should I connect to port 22 on home's PC? Apr 18, 2016 at 11:43
  • Sorry, i did misunderstand, see my edited comment above
    – gerhard d.
    Apr 18, 2016 at 11:44
  • @gerhardd. why do I need "homeuser@..." ? "homeuser" is me on my home's PC, where I try to connect to work, do I need it? Did you mean homeuser@localhost? Apr 18, 2016 at 11:46
  • Ah, sorry2. You may give me a downvote for not reading tightly.. :( The reverse tunnel seems to be okay. You may verify this with "netstat -nap --inet --tcp", and look at the open connections at your work pc. As a second step, you need to make shure the ssh-daemon is listening on the work pc at localhost:22. This is also visible in the netstat - output. Please post it here, so we may look at it.
    – gerhard d.
    Apr 18, 2016 at 11:52

1 Answer 1


This line:

 tcp 0 1 SYN_SENT 2366/ssh

tells us, that the ssh-connection from the work pc to the home-pc has not been completed. So either a) the port forwarding from the router to the home-pc does not work, or b) the ssh-d on the home pc is not listening to the (correct) address

  • Ssh connection didn't really complete, as port forwarding was not correct on router. For simplicity I created 22 to 22 port forwarding on router as @gerhard suggested and it did work. Thank you @gerhard! Apr 18, 2016 at 13:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .