Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I try to set up a Ubuntu System that routes all traffic through a socks5 ssh tunnel to a Debian proxy machine. tcpsocks https://github.com/vi/tcpsocks seems to do this, but I failed to set it up. I have found this Routing all traffic thru socks proxy using ssh -D but it didn't help me that much. Does anyone have a howto for this? And do I need a SOCKS5 Server on the Proxy machine or is OpenSSH sufficient?

On the Ubuntu Client I did the following:

# # Prepare iptables:
# iptables -t nat -N QQQ
# iptables -t nat -A QQQ -d -p tcp --dport 22 -j RETURN
# iptables -t nat -A QQQ -p tcp -j REDIRECT --to-ports 1234
# iptables -t nat -I OUTPUT 1 -j QQQ
# iptables -t nat -I PREROUTING 1 -j QQQ

$ # connect to SSH:
$ ssh -D vi@

$ # start tcpsocks:
$ tcpsocks 1234 REDIRECT REDIRECT 1080

That should be sufficient in order to run, right? On the Server I did nothing, I just installed OpenSSH. What's wrong with that?

share|improve this question
Which step you failed? Do you want to consider other options? –  quanta Sep 4 '11 at 8:21
Ian, you can update your question with that info, rather than writing it as a comment, it's much easier to read that way and helps keep everything in one place. –  EightBitTony Sep 4 '11 at 10:18
You're right, sorry. I did what you mentioned. –  Ian Sep 4 '11 at 10:26

Your Answer


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

Browse other questions tagged or ask your own question.