Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Concerning the Netcat/Socat utility . From the man page, it seems like it is possible to create a secure proxy using netcat by which I could point my web browser to like a proxy server , that could fork/drive my web traffic through the proxy. Is this possible? Any hints on how to do this? Socat on windows is preferrable but netcat on linux is ok.

share|improve this question
up vote 2 down vote accepted

Using netcat or socat as proxy will only work for a single website, if at all. This is because your browser can't instruct netcat/socat to connect to a specific target IP. socat's proxy connection functionality is also limited to connecting to a single IP through an existing HTTP proxy.

For an ad-hoc HTTP proxy, use ssh. This will open a socks 5 compatible server on port 8080:

ssh -NCD8080 user@your.proxy.server

Option -N removes shell, -C adds compression, -D is for socks proxy. Any browser supporting socks proxy can now connect to localhost port 8080.

share|improve this answer
I've implemented a patch to allow socat understand SO_ORIGINAL_DST (set by iptables in REDIRECT target), so you may specify "REDIRECT" instead of destination address or port in proxies. I use patched socat myself, but it is quick and dirty and probably not for serious production. May be in the next version this feature will be available out-of-the-box. socat 'tcp-l:1234,reuseaddr,fork' 'socks5:REDIRECT:REDIRECT|tcp:' It also works with HTTP CONNECT proxy. <a href="">link</a>; – Vi. Apr 3 '10 at 2:58

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.