TARGET EXTENSIONS
iptables can use extended target modules: the following are included in
the standard distribution.
复制内容到剪贴板
代码:
DNAT
This target is only valid in the nat table, in the PREROUTING and OUT-
PUT chains, and user-defined chains which are only called from those
chains. It specifies that the destination address of the packet should
be modified (and all future packets in this connection will also be
mangled), and rules should cease being examined. It takes one type of
option:
--to-destination ipaddr[-ipaddr][:port-port]
which can specify a single new destination IP address, an inclu-
sive range of IP addresses, and optionally, a port range (which
is only valid if the rule also specifies -p tcp or -p udp). If
[code]no port range is specified, then the destination port will never
be modified.You can add several --to-destination options. If you specify more
than one destination address, either via an address range or
multiple --to-destination options, a simple round-robin (one
after another in cycle) load balancing takes place between these
adresses.
[/code]
--to-destination 使用方法错误,在DNAT后加REDIRECT试试
iptables -t nat -A PREROUTING --dport 81 -i eth0 -j REDIRECT --to 80