3

I am trying to forward port from A:1234 to B:5678. Now, C will connect to A:1234 and will get forwarded to B:5678.

I could get this to work using PuTTY using this configuration: PuTTY Tunnels Configuration screenshot

Now, I am trying to do the same using plink. Unfortunately, I don't know what option should I use with plink that would be equivalent to "Local ports accept connections from other hosts" in the screenshot. The command I tried is

plink -i dummy.ppk -L *:5678:localhost:1234 account@12.34.56.78

What would be the plink equivalent of the above screenshot?

  • Have you read the man page? Looks like -L might be the right option. It works in a similar way. Try it. https://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html – hookenz Mar 28 '17 at 21:09
  • I tried with "-L". A->B SSH connection gets established. But C->A->B doesn't work. I am not sure what I am missing. –  Mar 28 '17 at 21:20
  • There are other options like -R. That might be what you're after. Read the manual and try it. – hookenz Mar 28 '17 at 21:24
  • Got it working with this: plink -i dummy.ppk -L 0.0.0.0:5678:localhost:1234 account@12.34.56.78 Thanks... –  Mar 28 '17 at 21:41

1 Answers1

4

Got the solution. By changing from

plink -i dummy.ppk -L *:5678:localhost:1234 account@12.34.56.78

to

plink -i dummy.ppk -L 0.0.0.0:5678:localhost:1234 account@12.34.56.78

it is working as expected.

The difference was this: With the first command, Sysinternals TCPView showed plink.exe opening a connection with local address as 127.0.0.1. With the second command, the local address became 0.0.0.0. I guess this tells plink to accept connections from other hosts.