1REDIR(1) System Manager's Manual REDIR(1)
2
4 redir — redirect TCP connections
5
7 redir [-hinpsv] [-b IP] [-f TYPE] [-I NAME] [-l LEVEL] [-m BPS]
8 [-o <1,2,3>] [-t SEC] [-w MSEC] [-x HOST:PORT] [-z BYTES]
9 [SRC]:PORT [DST]:PORT
10
12 redir redirects TCP connections coming in on a local port, [SRC]:PORT, to
13 a specified address/port combination, [DST]:PORT. Both the SRC and DST
14 arguments can be left out, redir will then use 0.0.0.0.
15
16 redir can be run either from inetd or as a standalone daemon. In --inetd
17 mode the listening SRC:PORT combo is handled by another process, usually
18 inetd, and a connected socket is handed over to redir via stdin. Hence
19 only [DST]:PORT is required in --inetd mode. In standalone mode redir
20 can run either in the foreground, -n, or in the background, detached like
21 a proper UNIX daemon. This is the default. When running in the fore‐
22 ground log messages are also printed to stderr, unless the -s flag is
23 given.
24
25 Depending on how redir was compiled, not all options may be available.
26
28 Mandatory arguments to long options are mandatory for short options too.
29
30 -b, --bind=IP
31 Forces redir to pick a specific address to bind to when it lis‐
32 tens for incoming connections. Not applicable when running in
33 Linux's transparent proxy mode, -p.
34
35 -h, --help
36 Show built-in help text.
37
38 -f, --ftp=TYPE
39 When using redir for an FTP server, this will cause redir to also
40 redirect FTP connections. Type should be specified as either
41 "port", "pasv", or "both", to specify what type of FTP connection
42 to handle. Note that --transproxy often makes one or the other
43 (generally port) undesirable.
44
45 -i, --inetd
46 Run as a process started from inetd(1), with the connection
47 passed as stdin and stdout on startup.
48
49 -I, --ident=NAME
50 Specify program identity (name) to be used for TCP wrapper checks
51 and syslog messages.
52
53 -l, --loglevel=LEVEL
54 Set log level: none, err, notice, info, debug. Default is no‐
55 tice.
56
57 -n, --foreground
58 Run in foreground, do not detach from controlling terminal.
59
60 -p, --transproxy
61 On a Linux system with transparent proxying enabled, causes redir
62 to make connections appear as if they had come from their true
63 origin. See the file transproxy.txt in the distribution, and the
64 Linux Documentation/networking/tproxy.txt for details. Untested
65 on modern Linux kernels.
66
67 -s, --syslog
68 Log messages to syslog. Default, except when -n is enabled.
69
70 -t, --timeout=SEC
71 Timeout and close the connection after SEC seconds of inactivity.
72
73 -v Show program version.
74
75 -x, --connect
76 Redirects connections through an HTTP proxy which supports the
77 CONNECT command. Specify the address and port of the proxy using
78 [DST]:PORT. --connect requires the hostname and port which the
79 HTTP proxy will be asked to connect to.
80
82 The following options control traffic shaping, if redir is built with
83 shaping enabled.
84
85 -m, --max-bandwidth=BPS
86 Reduce the bandwidth to be no more than BPS bits/sec. The algo‐
87 rithm is basic, the goal is to simulate a slow connection, so
88 there is no peak acceptance.
89
90 -o, --wait-in-out=<1,2,3>
91 Apply --max-bandwidth and --random-wait for input(1), output(2),
92 or both(3).
93
94 -w, --random-wait=MSEC
95 Wait between 0 and 2 x n milliseconds before each "packet". A
96 "packet" is a block of data read in one time by redir. A
97 "packet" size is always less than the bufsize (see also
98 --bufsize)
99
100 -z, --bufsize=BYTES
101 Set the bufsize (default 4096) in bytes. Can be used combined
102 with --max-bandwidth or --random-wait to simulate a slow connec‐
103 tion.
104
106 Command line syntax changed in v3.0. Compatibility with v2.x can be en‐
107 abled using the --enable-compat configure option. This enables the fol‐
108 lowing options: --laddr=ADDR --lport=PORT --caddr=ADDR --cport=PORT which
109 in v3.0 were been replaced with [SRC]:PORT and [DST]:PORT.
110
111 For full compatibility, using any of these options will implicitly also
112 enable -n. There is currently no way to tell redir to background itself
113 in this mode of operation.
114
116 inetd(1) uredir(1)
117
119 redir is written by Nigel Metheringham and Sam Creasey, with contribu‐
120 tions from many others. It is currently being maintained at GitHub by
121 Joachim Nilsson.
122
123BSD 01 May, 2016 BSD