Answers:
尝试以下iptables
规则:
$ sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination IP:80
上面说:
-t nat
)。-A
)到出站流量(OUTPUT
)。-p tcp
)感兴趣。--dport 80
)的流量感兴趣。-j DNAT
)。--to-destination IP:80
)。DNAT
This target is only valid in the nat table, in the PREROUTING and OUTPUT
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.
这可以允许您将端口转换为所有IP地址。这里的主要区别是该--to-destination
字段中缺少IP地址。
iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination :80
firewalld
吗?