2010-11-29 10 views
15

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

答えて

4

をサポートしていません。通常、NAT環境ではNATを使用していますが、NATは一般的にIPv6でサポートされていません。

普通のユーザーとして低ポートにバインドするだけでよい場合は、this answerに記載されている回避策を試してみてください。もちろん、Tomcatの場合、これはJavaのプロセスにその能力を与えることを意味するように思えます。

+7

明らかに 'ip6tables' v1.4.18とLinuxカーネルv3.8は' REDIRECT'をサポートしています:https://sector7g.be/posts/ipv6-nat-pre-routing-with-iptables –

5

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

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 

しかし、私はまだ試していない。

+0

あなたはもっと難しいでしょうIPv4ではREDIRECTより... TPROXYはmangleテーブルに特別な動作をしているので、それにマークを付けて高度なルーティングをする必要があります。 –

+0

"--on-ip"にはどのnetfilter-Versionが必要ですか? ip6tables v1.4.8(Debian Squeezeパッケージ)は動作しません。前もって感謝します ! – int2000

+1

私のテストボックスで/usr/share/doc/iptables/changelog.Debian.gzを短く検索した後、1.4.11.1-1にhttp://bugs.debianのように記載されているようです。 org/cgi-bin/bugreport.cgi?bug = 529954 –

関連する問題