http://i.stack.imgur.com/YTOvt.pngGoal: 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 tsocksyum install tsocksconfigure it [by default there is no config file..]vim /etc/tsocks.confserver = 127.0.0.1server_port = 4000create the ssh tunnelssh -v -fND localhost:4000 USERNAME@SERVER-Acheck that if it's createdps aux | fgrep -i sshUSER      8894  0.0  0.0   9780   708 ?        Ss   11:58   0:00 ssh -v -fND localhost:4000 USERNAME@SERVER-Anetstat -tulpn | fgrep -i sshtcp        0      0 127.0.0.1:4000              0.0.0.0:*                   LISTEN      8894/sshhow to use tsockstsocks ssh root@SERVER-Bkill the ssh tunnelkill `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 PCThank you!
Multiple SSH chaining (tsocks, socksify, proxycommand, etc. )
linux;fedora;ssh tunneling
tsocks allows multiple SOCKS services, you set it up to use a different SOCKS service (i.e. different ssh -D listening on a different port) for each desired target. man tsocks.conf for more details.assuming /etc/tsocks.conf containing:path {    server = localhost    server_port = 1081    reaches = <ip-address-of-server-b>/32    }path {    server = localhost    server_port = 1082    reaches = <ip-address-of-server-d>/32    }Then you would runssh -fND :1081 server-a & sleep 1 ; tsocks ssh server-bssh -fND :1082 server-c & sleep 1 ; tsocks ssh server-d