blob: 040571bb9aa01f369c7df4d641a0f648cb3a7f12 [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 POSTROUTING
5chain. It specifies that the source address of the packet should be
6modified (and all future packets in this connection will also be
7mangled), and rules should cease being examined. It takes one type
8of option:
9.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010010\fB\-\-to\-source\fP \fIipaddr\fP[\fB\-\fP\fIipaddr\fP][\fB:\fP\fIport\fP[\fB\-\fP\fIport\fP]]
Henrik Nordstromc2794132004-01-22 15:04:24 +000011which can specify a single new source IP address, an inclusive range
12of IP addresses, and optionally, a port range (which is only valid if
13the rule also specifies
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010014\fB\-p tcp\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +000015or
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010016\fB\-p udp\fP).
Henrik Nordstromc2794132004-01-22 15:04:24 +000017If no port range is specified, then source ports below 512 will be
18mapped to other ports below 512: those between 512 and 1023 inclusive
19will be mapped to ports below 1024, and other ports will be mapped to
Patrick McHardyef399a32007-05-29 11:24:45 +0000201024 or above. Where possible, no port alteration will
21
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010022In Kernels up to 2.6.10, you can add several \-\-to\-source options. For those
Harald Weltea4749bc2005-08-29 12:50:20 +000023kernels, if you specify more than one source address, either via an address
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010024range or multiple \-\-to\-source options, a simple round-robin (one after another
Harald Welte599d2a12006-01-22 16:02:32 +000025in cycle) takes place between these addresses.
Harald Weltea4749bc2005-08-29 12:50:20 +000026Later Kernels (>= 2.6.11-rc1) don't have the ability to NAT to multiple ranges
27anymore.
Patrick McHardyef399a32007-05-29 11:24:45 +000028.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010029\fB\-\-random\fP
Patrick McHardyef399a32007-05-29 11:24:45 +000030If option
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010031\fB\-\-random\fP
Patrick McHardyef399a32007-05-29 11:24:45 +000032is used then port mapping will be randomized (kernel >= 2.6.21).
33.RS
34.PP