Tcp port redirections with redir


Redir is a port redirector.

It’s functionally basically consists of the ability to listen for TCP connections on a given port, and when it recieves a connection, to then connect to a given destination address/port, and pass data between them.

To redirect TCP connections with redir utility, simply type the command such as below:

redir --laddr=<listen_address> --lport=<listen_port>  \
      --caddr=<connect_address>  --cport=<connect_port>

Suppose that the ip address of our system is and we would like to redirect all the traffic which coming from port 80 to a remote server with ip address of and port 8080. Simply, we want redir utility to redirect connections coming to on port 80 to port 8080. We have to run redir such as below to do so:

redir --laddr= --lport=80  --caddr= --cport=8080

Local address specified with --laddr should be one of the ip addresses that we can access our redirecting system. Setting other ip addresses will make no sense.

redir also has a transparent proxy feature. You can use iptables for this type of redirection too but if you can’t use iptables for any reason, it is possible to use transproxy support any port you want like that:

redir --transproxy 80 3120