Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I know I can create an ssh tunnel and then tell a program (with tsocks) to use it for networking. But. How can I put an ssh tunnel in an ssh tunnel? I mean I can't again use the tsocks in tsocks because I can't provide a good tsocks.conf [and not a solution even if someone could:)].

So how can I tell an ssh tunnnel to use an ssh tunnel?

Scenario:

PC-A ->> ROUTER -->> PC-B
  • PC-A: I'm this guy
  • ROUTER: this is the router (we don't want port forward on it, only ssh)
  • PC-B: the machine that I need to ssh tunnel from PC-A.

So I need a tunnel to the router. Then I need a tunnel that uses the router's tunnel so that I can reach PC-B behind NAT.

share|improve this question
    
Could you try and explain a bit better what you are trying to achieve? What would that "tunnel in a tunnel" connect to? (Simply listing what hosts you have, who can connect to what, and what tunnels you want to set up should clarify things.) –  Mat Jan 4 '12 at 10:10
    
I updated the Question –  LanceBaynes Jan 4 '12 at 10:16
2  
add comment

1 Answer

The first tunnel wouldnt be a socks tunnel. Say you have PC->hostA->hostB and you want the proxy through hostB from PC

ssh -t -L 1080:localhost:1080 hostA "ssh -D 1080 hostB"

Then use localhost:1080 as the socks server on PC.

When you connect to localhost:1080 from PC, the connection is forwarded to localhost:1080 on hostA which is the socks server that tunnels through hostB.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.