Tunneling Using Plink: Command Line Option for "Local ports accept connections from other hosts"

3

1

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?

unni

Posted 2017-03-28T20:53:07.260

Reputation:

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

– Matt H – 2017-03-28T21:09:09.573

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. – None – 2017-03-28T21:20:34.163

There are other options like -R. That might be what you're after. Read the manual and try it. – Matt H – 2017-03-28T21:24:01.227

Got it working with this:

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

Thanks... – None – 2017-03-28T21:41:33.003

Answers

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.

unni

Posted 2017-03-28T20:53:07.260

Reputation:

10.0.0.0 means all IPv4 addresses on all adapters on the local machine – Matt H – 2017-03-29T00:13:16.847