Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an application that opens connections on dozens of ports, and doesn't provide documentation about which ports it uses. I could use Wireshark or something to capture the traffic and export the ports from that, but I think it should be simpler than that. (And I'm not sure I would be able to cover all use cases and ensure the app used every single port it can ever use.)

So I'm looking for a way to just say "forward all traffic from this application" (bonus points for all traffic from child processes as well) without needing to worry about specific ports. I'm sure there must be a way, but I couldn't hit on the right keywords while searching Google. How can I do this?

Note that I want to do this for apps that don't support proxies, not a web browser or anything, and I don't want to rely on a third-party service.

share|improve this question
What application? What OS? What SSH client? Have you considered a real VON? –  Zoredache Jun 2 '12 at 22:33
@Zoredache The OS is probably relevant, my bad, I've retagged the question. This is generalizable to any app and I'm not set on a particular SSH client. Is a VPN usable with a single app and can I easily set it up without relying on 3rd-party services? –  Matthew Read Jun 2 '12 at 22:50

1 Answer 1

You can use SSH to provide a SOCKS proxy, and then an LD_PRELOAD wrapper which transparently uses the SOCKS proxy for all traffic. To create a SOCKS proxy, use the -D parameter to ssh:

ssh -D 1080 server.example.com

This will expose a SOCKS server on localhost:1080 which will tunnel everything over the SSH connection. Then install socksify from Dante or tsocks, configure it to use localhost:1080 as a SOCKS5 server, and run your application under it.

share|improve this answer
"Everything" is "everything from all apps", yes? I'm looking for a solution for a single app, the rest of my traffic should not be forwarded. I'm also on Windows, sorry for not mentioning that. –  Matthew Read Jun 2 '12 at 22:49
@MatthewRead "Everything" means "all traffic from applications explicitly started with socksify/tsocks". This isn't going to work on Windows however. –  mgorven Jun 2 '12 at 23:57
I've tried this on Ubuntu 11.04 and haven't been able to get it to work. I installed the packages, set LD_PRELOAD="libdl.so libdsocksd.so.0" and SOCKS_SERVER=, and then tried socksify but no luck. (I've tested Firefox and Chrome, and verified that the SSH forwarding is working by changing their proxy settings. It's just socksify that doesn't seem to do anything, the browsers behave as if there was no proxy.) –  Matthew Read Jun 7 '12 at 21:01

Your Answer


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.