redir1
Redirect tcp connections
Usage
redir [-hinpsv]
[-b
IP]
[-f
TYPE]
[-I
NAME]
[-l
LEVEL]
[-m
BPS]
[-o
<1,2,3>]
[-t
SEC]
[-w
MSEC]
[-x
HOST:PORT]
[-z
BYTES]
[SRC]
:PORT
[DST]
:PORT
Overview
redir redirects TCP connections coming in on a local port, [SRC]:PORT, to a specified address/port combination, [DST]:PORT. Both the SRC and DST arguments can be left out, redir will then use 0.0.0.0.
redir can be run either from inetd or as a standalone daemon. In --inetd mode the listening SRC:PORT combo is handled by another process, usually inetd, and a connected socket is handed over to redir via stdin. Hence only [DST]:PORT is required in --inetd mode. In standalone mode redir can run either in the foreground, -n, or in the background, detached like a proper UNIX daemon. This is the default. When running in the foreground log messages are also printed to stderr, unless the -s flag is given.
Depending on how redir was compiled, not all options may be available.
Options
Mandatory arguments to long options are mandatory for short options too.
-
-b, --bind=IP -
Forces
redirto pick a specific address to bind to when it listens for incoming connections. Not applicable when running in Linux's transparent proxy mode,-p. -
-h, --help -
Show built-in help text.
-
-f, --ftp=TYPE -
When using
redirfor an FTP server, this will cause redir to also redirect FTP connections. Type should be specified as either "port", "pasv", or "both", to specify what type of FTP connection to handle. Note that--transproxyoften makes one or the other (generally port) undesirable. -
-i, --inetd -
Run as a process started from inetd(1), with the connection passed as stdin and stdout on startup.
-
-I, --ident=NAME -
Specify program identity (name) to be used for TCP wrapper checks and syslog messages.
-
-l, --loglevel=LEVEL -
Set log level: none, err, notice, info, debug. Default is notice.
-
-n, --foreground -
Run in foreground, do not detach from controlling terminal.
-
-p, --transproxy -
On a Linux system with transparent proxying enabled, causes
redirto make connections appear as if they had come from their true origin. See the file transproxy.txt in the distribution, and the Linux Documentation/networking/tproxy.txt for details. Untested on modern Linux kernels. -
-s, --syslog -
Log messages to syslog. Default, except when
-nis enabled. -
-t, --timeout=SEC -
Timeout and close the connection after SEC seconds of inactivity.
-
-v -
Show program version.
-
-x, --connect -
Redirects connections through an HTTP proxy which supports the CONNECT command. Specify the address and port of the proxy using [DST]:PORT.
--connectrequires the hostname and port which the HTTP proxy will be asked to connect to.
Traffic shaping
The following options control traffic shaping, if redir is built with shaping enabled.
-m,--max-bandwidth=BPS-
Reduce the bandwidth to be no more than BPS bits/sec. The algorithm is basic, the goal is to simulate a slow connection, so there is no peak acceptance.
-o,--wait-in-out=<1,2,3>-
Apply
--max-bandwidthand--random-waitfor input(1), output(2), or both(3). -w,--random-wait=MSEC-
Wait between 0 and 2 x n milliseconds before each "packet". A "packet" is a block of data read in one time by redir. A "packet" size is always less than the bufsize (see also
--bufsize) -z,--bufsize=BYTES-
Set the bufsize (default 4096) in bytes. Can be used combined with
--max-bandwidthor--random-waitto simulate a slow connection.
Releases
17 releases since Debian 1.2 (Rex); the text changed 6 times.
--bind since Debian 9 (Stretch);
--connect since Debian 4.0 (Etch);
--foreground since Debian 9 (Stretch);
--ftp since Debian 2.2 (Potato);
--help since Debian 9 (Stretch);
--ident since Debian 9 (Stretch);
--loglevel since Debian 9 (Stretch);
--transproxy since Debian 2.2 (Potato);
-I since Debian 9 (Stretch);
-b since Debian 9 (Stretch);
-f since Debian 9 (Stretch);
-h since Debian 9 (Stretch);
-i since Debian 9 (Stretch);
-l since Debian 9 (Stretch);
-n since Debian 9 (Stretch);
-p since Debian 9 (Stretch);
-s since Debian 9 (Stretch);
-t since Debian 9 (Stretch);
-v since Debian 9 (Stretch);
-x since Debian 9 (Stretch).
--bind_addr until Debian 8 (Jessie);
--bufsize until Debian 8 (Jessie);
--caddr until Debian 8 (Jessie);
--cport until Debian 8 (Jessie);
--debug until Debian 8 (Jessie);
--laddr until Debian 8 (Jessie);
--lport until Debian 8 (Jessie);
--max_bandwidth until Debian 8 (Jessie);
--name until Debian 8 (Jessie);
--random_wait until Debian 8 (Jessie);
--wait_in_out until Debian 8 (Jessie).