TranSocks - Transparent SOCKSifying Proxy

SourceForge Logo


What: TranSocks is a transparent proxy that relays traffic through a SOCKS proxy.

Why: If your want to transparently route network traffic through a SOCKS server, then TranSocks is for you. You might need to do this for one or more of the following reasons:

  • Your satellite service provider has performance-enhancing proxies that use SOCKS
  • Your network provider only allows SOCKS access to the Internet
  • You want to use an anonymization service such as EFF's Tor Onion Router

How: Transocks is a user-space daemon for Linux that does this, in conjunction with Linux IP Tables. You can use TranSocks to only handle traffic from the Linux machine running TranSocks, or you can run it on a Linux router that other machines on your network route through. Many TCP applications will work without modifications. TranSocks currently uses SOCKS version 4 and therefore does not support UDP.


How is TranSocks different from tsocks or socksify?
TranSocks is a network-layer proxy that can run on a Linux router and without controlling how applications are run. In contrast, tools like tsocks and Dante's socksify are Unix applications that run applications in an environment that intercepts calls to network libraries.


We don't currently distribute binaries, so you will have to compile TranSocks yourself. The source code can be downloaded from anonymous CVS.

To compile TranSocks, you will first need a SOCKS client library such as:


Run TranSocks:
/usr/local/sbin/transocks (or wherever you installed it)
TranSocks takes two options:
Normally TranSocks runs as a daemon and logs all messages to syslog. For debugging, you might want it to run in the foreground. -f tells TranSocks to run in fg and dump messages to stderr.
-p port
By default, TranSocks listens on 1211. Use this option to make it listen on some other port. Make sure to change the firewall script as well.

Transocks doesn't need to run as root unless you want it to listen on a privileged port.

You should be running Linux with IP Tables. You will need to setup firewall rules to enable the transparent proxy. The following script creates a SOCKSIFY chain for all TCP traffic destined for hosts outside the local network:



iptables -t nat -X SOCKSIFY
iptables -t nat -N SOCKSIFY
iptables -t nat -A SOCKSIFY -o lo -j RETURN
iptables -t nat -A SOCKSIFY --dst -j RETURN
iptables -t nat -A SOCKSIFY --dst $LOCAL_NET -j RETURN
        #Avoid feedback loops
iptables -t nat -A SOCKSIFY -m owner --cmd-owner transocks -j RETURN
iptables -t nat -A SOCKSIFY -j LOG -p tcp --syn --log-level info \
--log-prefix "SOCKSify "
	#Send to transocks
iptables -t nat -A SOCKSIFY -p tcp -j REDIRECT --to-port 1211

# Socksify traffic leaving this host:
iptables -t nat -A OUTPUT -p tcp --syn -j SOCKSIFY

# Socksify traffic routing through this host:
iptables -t nat -A PREROUTING -p tcp -s $LOCAL_NET --syn -j SOCKSIFY


There's no support for UDP at present.

Transocks forks and creates a new process to service each connection. This is the simplest way to do it but it's not very scalable as it is limited by the maximum number of processes.

FTP will only work in passive mode. Other application protocols which similarly use reverse connections will also not work.

Transocks is best used for those apps that do not support SOCKS natively. Direct usage of SOCKS is likely to have better performance, and certainly has broader protocol support.

Future Work

(Volunteers Welcome)

  • UDP / SOCKS 5 support
  • Authentication and authorization


Please send bug reports/patches/comments to:

The latest version of TranSocks is available at: