December 4th, 2012, 11:59 PM
TCP port forwarding using SSH
I did a quick forum search but couldn't find an answer to this one
How do I enable port forwarding using SSH?
I have three devices
1- Desktop Computer
2- Server B (named bems)
3- Router C
I want to be able to ssh from computer to Router C , through Server B; hence I need to set up port forwarding on Server B
(see attached image file)
I have tried this but this does not work:
server-b# ssh -L 2221:220.127.116.11:22 localhost
... I keep getting "Fatal error, connection refused"
Aside - Socat
I have socat partially working and ssh is forwarded,
but each time I run my script that automates SSH, it crashes...
server-b# /opt/csw/bin/socat -ddd -v -ls -s -4 tcp-listen:2221 tcp-connect:18.104.22.168:22
For one to know everything, first one must accept he knows nothing.
December 5th, 2012, 12:53 AM
From desktop computer you would run this in one terminal:
Then in a second terminal on desktop computer you would run this:
desktop$ ssh -L 2221:routerc:22 serverb
Leave the first terminal open to maintain the tunnel. The second terminal will be connected to routerc through serverb.
desktop$ ssh -p 2221 localhost