blob: d1e0a3a18566333c3b02292f157e9757a513d9ee [file] [log] [blame]
Henrik Nordstromc2794132004-01-22 15:04:24 +00001This target is only valid in the
2.B nat
3table, in the
4.B PREROUTING
5and
6.B OUTPUT
7chains, and user-defined chains which are only called from those
8chains. It specifies that the destination address of the packet
9should be modified (and all future packets in this connection will
10also be mangled), and rules should cease being examined. It takes one
11type of option:
12.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010013\fB\-\-to\-destination\fP [\fIipaddr\fP][\fB\-\fP\fIipaddr\fP][\fB:\fP\fIport\fP[\fB\-\fP\fIport\fP]]
Henrik Nordstromc2794132004-01-22 15:04:24 +000014which can specify a single new destination IP address, an inclusive
15range of IP addresses, and optionally, a port range (which is only
16valid if the rule also specifies
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010017\fB\-p tcp\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +000018or
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010019\fB\-p udp\fP).
Henrik Nordstromc2794132004-01-22 15:04:24 +000020If no port range is specified, then the destination port will never be
Evan Miller81858012006-05-24 16:21:57 +000021modified. If no IP address is specified then only the destination port
22will be modified.
Patrick McHardyef399a32007-05-29 11:24:45 +000023
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010024In Kernels up to 2.6.10 you can add several \-\-to\-destination options. For
Harald Welted2baafe2005-08-29 12:48:13 +000025those kernels, if you specify more than one destination address, either via an
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010026address range or multiple \-\-to\-destination options, a simple round-robin (one
Harald Welte599d2a12006-01-22 16:02:32 +000027after another in cycle) load balancing takes place between these addresses.
Harald Welted2baafe2005-08-29 12:48:13 +000028Later Kernels (>= 2.6.11-rc1) don't have the ability to NAT to multiple ranges
29anymore.
Patrick McHardyef399a32007-05-29 11:24:45 +000030.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010031\fB\-\-random\fP
Patrick McHardyef399a32007-05-29 11:24:45 +000032If option
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010033\fB\-\-random\fP
Patrick McHardyef399a32007-05-29 11:24:45 +000034is used then port mapping will be randomized (kernel >= 2.6.22).
Jan Engelhardt6d7d91e2009-06-08 15:46:19 +020035.TP
36\fB\-\-persistent\fP
37Gives a client the same source-/destination-address for each connection.
38This supersedes the SAME target. Support for persistent mappings is available
39from 2.6.29-rc2.