https://i.stack.imgur.com/YTOvt.png
Goal: you need to reach "Server B" from the Client "directly" with SSH, SCP.
"Server B" is next to "Server A". E.g.: they're on the same subnet, but only "Server A" is reachable from the Internet -> so "Server B" is only indirectly accessible.
I know how to use tsocks:
install tsocks
yum install tsocks
configure it [by default there is no config file..]
vim /etc/tsocks.conf
server = 127.0.0.1
server_port = 4000
create the ssh tunnel
ssh -v -fND localhost:4000 USERNAME@SERVER-A
check that if it's created
ps aux | fgrep -i ssh
USER 8894 0.0 0.0 9780 708 ? Ss 11:58 0:00 ssh -v -fND localhost:4000 USERNAME@SERVER-A
netstat -tulpn | fgrep -i ssh
tcp 0 0 127.0.0.1:4000 0.0.0.0:* LISTEN 8894/ssh
how to use tsocks
tsocks ssh root@SERVER-B
kill the ssh tunnel
kill `pgrep -f 'D localhost:4000'`
The whole thing is fully OK to me. Fine.
The Question: How can I use multiple ssh tunnels with e.g.: tsocks?
I mean I have to use several ssh tunnels (on different ports of course).
How can I set e.g.: tsocks to "memorize" several ssh tunnels (ports)?
The "/etc/tsocks.conf" file only allows one server, that's ok, because If I ssh tunnel to somewhere I have to go through 127.0.0.1, but I need more ports, because 1 port = 1 ssh tunnel. Several ssh tunnels can't bind to 1 port.
I'm using Fedora 14 for "Desktop PC"
Thank you!