17

ip6tables を使用して、あるポートを別のローカル ポートにリダイレクトするにはどうすればよいですか? 例: ip6tables -t nat -A PREROUTING -j REDIRECT -p tcp --dport 443 --to-ports 8443

4

2 に答える 2

7

これは古い質問ですが、同じことをする必要があるので…これが私が見つけたものです:

TPROXY

This target is only valid in the mangle table, in the PREROUTING chain and user-defined chains which are only called from this chain. It redirects the packet to a local socket without changing the packet header in any way. It can also change the mark value which can then be used in advanced routing rules. It takes three options:
--on-port port
    This specifies a destination port to use. It is a required option, 0 means the new destination port is the same as the original. This is only valid if the rule also specifies -p tcp or -p udp. 
--on-ip address
    This specifies a destination address to use. By default the address is the IP address of the incoming interface. This is only valid if the rule also specifies -p tcp or -p udp. 
--tproxy-mark value[/mask]
    Marks packets with the given value/mask. The fwmark value set here can be used by advanced routing. (Required for transparent proxying to work: otherwise these packets will get forwarded, which is probably not what you want.)

もちろん、これは ip6tables にのみ有効です。だから私はこれが有効だと思います:

ip6tables -t mangle -A PREROUTING -p tcp --dport 443 -j TPROXY --on-port 8443

ただし、まだ試していません。

于 2012-06-18T15:13:19.460 に答える
5

ip6tables対応しておりませんREDIRECT。(通常、人々はこれを NAT 環境で使用します。NAT は通常、IPv6 ではサポートされていません。)

通常のユーザーとして低いポートにバインドするだけでよい場合は、この回答で説明されている回避策を試してみませんか? もちろん、Tomcat の場合、これはすべての Java プロセスにその機能を与えることを意味するように思えます。

于 2011-02-06T04:04:41.690 に答える