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 184.108.40.206 and we would like to redirect all the traffic which coming from port 80 to a remote server with ip address of 220.127.116.11 and port 8080. Simply, we want redir utility to redirect connections coming to 18.104.22.168 on port 80 to 22.214.171.124 port 8080. We have to run redir such as below to do so:
redir --laddr=126.96.36.199 --lport=80 --caddr=188.8.131.52 --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 184.108.40.206 80 3120