xref: /aosp_15_r20/external/iptables/extensions/libxt_DNAT.man (revision a71a954618bbadd4a345637e5edcf36eec826889)
1This 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 the
11following options:
12.TP
13\fB\-\-to\-destination\fP [\fIipaddr\fP[\fB\-\fP\fIipaddr\fP]][\fB:\fP\fIport\fP[\fB\-\fP\fIport\fP[\fB/\fIbaseport\fP]]]
14which can specify a single new destination IP address, an inclusive
15range of IP addresses. Optionally a port range,
16if the rule also specifies one of the following protocols:
17\fBtcp\fP, \fBudp\fP, \fBdccp\fP or \fBsctp\fP.
18If no port range is specified, then the destination port will never be
19modified. If no IP address is specified then only the destination port
20will be modified.
21If \fBbaseport\fP is given, the difference of the original destination port and
22its value is used as offset into the mapping port range. This allows to create
23shifted portmap ranges and is available since kernel version 4.18.
24For a single port or \fIbaseport\fP, a service name as listed in
25\fB/etc/services\fP may be used.
26.TP
27\fB\-\-random\fP
28Randomize source port mapping (kernel >= 2.6.22).
29.TP
30\fB\-\-persistent\fP
31Gives a client the same source-/destination-address for each connection.
32This supersedes the SAME target. Support for persistent mappings is available
33from 2.6.29-rc2.
34.TP
35IPv6 support available since Linux kernels >= 3.7.
36