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